diff --git a/src/main/kotlin/moe/nikky/RoleChooserConfig.kt b/src/main/kotlin/moe/nikky/RoleChooserConfig.kt index 76d3f33..3b45011 100644 --- a/src/main/kotlin/moe/nikky/RoleChooserConfig.kt +++ b/src/main/kotlin/moe/nikky/RoleChooserConfig.kt @@ -71,8 +71,14 @@ data class RoleMappingConfig( ) : Data { suspend fun reactionEmoji(guildBehavior: GuildBehavior): ReactionEmoji { return guildBehavior.emojis.firstOrNull { it.mention == reaction } - ?.let { ReactionEmoji.from(it) } - ?: ReactionEmoji.Unicode(reaction) + ?.let { + logger.traceF { "found emoji ${it.name}, turning into reaction emoji" } + ReactionEmoji.from(it) + } + ?: run { + logger.traceF { "creating unicode emoji from '$reaction'" } + ReactionEmoji.Unicode(reaction) + } } suspend fun getRole(guildBehavior: GuildBehavior): Role { return guildBehavior.getRole(role) diff --git a/src/main/kotlin/moe/nikky/RoleManagementExtension.kt b/src/main/kotlin/moe/nikky/RoleManagementExtension.kt index 56ed3f9..b1d858d 100644 --- a/src/main/kotlin/moe/nikky/RoleManagementExtension.kt +++ b/src/main/kotlin/moe/nikky/RoleManagementExtension.kt @@ -515,7 +515,9 @@ class RoleManagementExtension : Extension(), Klogging { } try { roleMapping.forEach { entry -> + logger.traceF { "parse emoji" } val reactionEmoji: ReactionEmoji = entry.reactionEmoji(guild) + logger.traceF { "get role ${entry.role}" } val role = entry.getRole(guild) logger.traceF { "adding reaction $reactionEmoji for role ${role.name}" } message.addReaction(reactionEmoji) @@ -526,7 +528,7 @@ class RoleManagementExtension : Extension(), Klogging { .filter { member -> role.id !in member.roleIds }.collect { member -> - logger.info { "adding '${role.name}' to '${member.effectiveName}'" } + logger.infoF { "adding '${role.name}' to '${member.effectiveName}'" } member.addRole(role.id) } } @@ -558,10 +560,10 @@ class RoleManagementExtension : Extension(), Klogging { channel as? TextChannel ?: relayError("${channel.mention} is not a Text Channel") } - val reaction = arguments.reaction - if(reaction is ReactionEmoji.Custom && reaction.isAnimated) { - relayError("animated emojis are not supported") - } +// val reaction = arguments.reaction +// if(reaction is ReactionEmoji.Custom && reaction.isAnimated) { +// relayError("animated emojis are not supported") +// } val configUnit = guild.config() val (key, roleChooserConfig) = configUnit.get()?.find(arguments.section, channel.id)