(client, guildId)
| 898 | } |
| 899 | |
| 900 | export async function getApplicationRoles(client, guildId) { |
| 901 | try { |
| 902 | if (!client.db || typeof client.db.get !== "function") { |
| 903 | logger.error("Database client is not available for getApplicationRoles."); |
| 904 | return []; |
| 905 | } |
| 906 | |
| 907 | const key = getApplicationRolesKey(guildId); |
| 908 | const roles = await client.db.get(key, []); |
| 909 | const unwrappedRoles = unwrapReplitData(roles); |
| 910 | return Array.isArray(unwrappedRoles) ? unwrappedRoles : []; |
| 911 | } catch (error) { |
| 912 | logger.error(`Error getting application roles for guild ${guildId}:`, error); |
| 913 | return []; |
| 914 | } |
| 915 | } |
| 916 | |
| 917 | export async function saveApplicationRoles(client, guildId, roles) { |
| 918 | try { |
no test coverage detected