Improved role selection
This commit is contained in:
@@ -30,3 +30,27 @@ func (discord *Discord) CreateMessageComponent(channelID string, content string,
|
||||
|
||||
return result.ID
|
||||
}
|
||||
|
||||
// UpdateMessageComponent updates a discord component
|
||||
func (discord *Discord) UpdateMessageComponent(messageID string, channelID string, content string, components []Component) string {
|
||||
dComponents := make([]discordgo.MessageComponent, len(components))
|
||||
for i, v := range components {
|
||||
dComponents[i] = v.toMessageComponent()
|
||||
}
|
||||
|
||||
result, err := discord.session.ChannelMessageEditComplex(&discordgo.MessageEdit{
|
||||
Components: dComponents,
|
||||
Content: &content,
|
||||
Channel: channelID,
|
||||
ID: messageID,
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("Error updating message component: %s", err)
|
||||
}
|
||||
|
||||
if result != nil {
|
||||
return result.ID
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user