From cf7bd44bb669785b69122af34ba4c9149e0e2739 Mon Sep 17 00:00:00 2001 From: RageCage64 Date: Sun, 16 Jan 2022 19:45:02 -0500 Subject: [PATCH] trying to add pronouns to bub --- roles.go | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/roles.go b/roles.go index e53bd73..54a0c73 100644 --- a/roles.go +++ b/roles.go @@ -23,10 +23,11 @@ type ServerRoleAssignConfig struct { type ServerConfigOptionFunction func(s *discordgo.Session) ServerRoleAssignConfig func InitRoleReactions(s *discordgo.Session) { - addHubbubHandlers(s) + addHubbubRoleHandlers(s) + addHubbubPronounHandlers(s) } -func addHubbubHandlers(s *discordgo.Session) { +func addHubbubRoleHandlers(s *discordgo.Session) { hubbubId := "827958531659530301" roleAssignChannelId := "855923187354959872" roleMap := map[string]RoleReaction{ @@ -47,6 +48,41 @@ func addHubbubHandlers(s *discordgo.Session) { s, hubbubId, roleAssignChannelId, + "React to this message to get a role!", + roleMap, + ) + s.AddHandler(roleAddHandler(serverConfig)) + s.AddHandler(roleRemoveHandler(serverConfig)) +} + +func addHubbubPronounHandlers(s *discordgo.Session) { + hubbubId := "827958531659530301" + roleAssignChannelId := "932432742547869726" + roleMap := map[string]RoleReaction{ + "🇭": { + RoleName: "He/Him", + RoleId: "932433573292699699", + EmojiName: "regional_indicator_h", + EmojiId: "🇭", + }, + "🇫": { + RoleName: "She/Her", + RoleId: "932433721750081587", + EmojiName: "regional_indicator_f", + EmojiId: "🇫", + }, + "🇹": { + RoleName: "They/Them", + RoleId: "932433573292699699", + EmojiName: "regional_indicator_t", + EmojiId: "🇹", + }, + } + serverConfig := getServerConfig( + s, + hubbubId, + roleAssignChannelId, + "React to this message to assign pronouns! You are allowed to select multiple.", roleMap, ) s.AddHandler(roleAddHandler(serverConfig)) @@ -57,6 +93,7 @@ func getServerConfig( s *discordgo.Session, guildId string, roleAssignChannelId string, + roleAssignMessage string, roleMap map[string]RoleReaction, ) ServerRoleAssignConfig { serverConfig := ServerRoleAssignConfig{ @@ -70,7 +107,7 @@ func getServerConfig( } if len(messages) == 0 { - content := "React to this message to get a role!\n" + content := fmt.Sprintf("%s\n", roleAssignMessage) for emote, role := range roleMap { content += fmt.Sprintf("%s : %s\n", emote, role.RoleName) }