Added pmsg command for admin to message channel as the bot

master
Matthieu Lalonde 5 years ago
parent 2b4fce2e87
commit 0a132ef5f6

@ -30,6 +30,7 @@ func (b *Type) loadDiscordHandlers() {
// Admin commands
// XXX: Promote
b.dg.Router.Route("reload", "Reload the bot's data and configs", b.handleReload)
b.dg.Router.Route("pmsg", "", b.handleMessageAsBot)
// Moderator commands
// XXX: Remove
b.dg.Router.Route("auser", "Associates an AltVR user to a discord user", b.handleAssociateUser)
@ -622,6 +623,16 @@ func (b *Type) handleReload(ds *discordgo.Session, dm *discordgo.Message, ctx *m
})
}
func (b *Type) handleMessageAsBot(ds *discordgo.Session, dm *discordgo.Message, ctx *mux.Context) {
//fmt.Printf("dm:\t%+v\nctv:\t%+v\n", dm, ctx)
if !b.checkUserRole(dm.Author.ID, RoleAdmin) {
b.replyPermissionDenied(ds, dm, ctx)
return
}
//uu, _ := b.getUserByDiscordID(dm.Author.ID)
b.dg.Session.ChannelMessageSend(b.DGcID, strings.TrimSpace(strings.Replace(ctx.Content, "pmsg", "", 1)))
}
/*
** Utilities
*/

Loading…
Cancel
Save