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