Make reaction roles easier to implement
Signed-off-by: Etzelia <etzelia@hotmail.com>pull/8/head
parent
c84c523e55
commit
c5066e84e2
|
@ -89,5 +89,9 @@ help = "Get the invite link"
|
|||
[[message_roles]]
|
||||
channel_id = "0"
|
||||
message_id = "0"
|
||||
[[message_roles.reactions]]
|
||||
role_id = "0"
|
||||
emoji = "👍"
|
||||
emoji = "👍"
|
||||
[[message_roles.reactions]]
|
||||
role_id = "0"
|
||||
emoji = "👎"
|
|
@ -60,8 +60,11 @@ type Config struct {
|
|||
type MessageRole struct {
|
||||
ChannelID string `toml:"channel_id"`
|
||||
MessageID string `toml:"message_id"`
|
||||
RoleID string `toml:"role_id"`
|
||||
Reactions []MessageReaction `toml:"reactions"`
|
||||
}
|
||||
type MessageReaction struct {
|
||||
Emoji string `toml:"emoji"`
|
||||
RoleID string `toml:"role_id"`
|
||||
}
|
||||
|
||||
type Echo struct {
|
||||
|
|
|
@ -79,8 +79,10 @@ func Bot(cfg *config.Config, db *database.Database) (*discordgo.Session, error)
|
|||
if messageRoleMap[messageRole.MessageID] == nil {
|
||||
messageRoleMap[messageRole.MessageID] = make(map[string]string)
|
||||
}
|
||||
_ = bot.MessageReactionAdd(messageRole.ChannelID, messageRole.MessageID, messageRole.Emoji)
|
||||
messageRoleMap[messageRole.MessageID][messageRole.Emoji] = messageRole.RoleID
|
||||
for _, reaction := range messageRole.Reactions {
|
||||
_ = bot.MessageReactionAdd(messageRole.ChannelID, messageRole.MessageID, reaction.Emoji)
|
||||
messageRoleMap[messageRole.MessageID][reaction.Emoji] = reaction.RoleID
|
||||
}
|
||||
}
|
||||
|
||||
// Init commandMap
|
||||
|
|
Loading…
Reference in New Issue