Add function to check member roles

pull/20/head
pocketjawa 2019-08-06 21:44:49 -04:00
parent 491f28236c
commit 202d852b1b
1 changed files with 16 additions and 0 deletions

View File

@ -10,6 +10,22 @@ import (
"strconv" "strconv"
) )
//Check member roles
func checkRole(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context, roleid string) bool {
if ctx.IsPrivate {
return false
}
channel, _ := s.Channel(m.ChannelID)
guild := channel.GuildID
member, _ := s.GuildMember(guild, m.Author.ID)
for _, role := range member.Roles {
if role == roleid {
return true
}
}
return false
}
//Generate a heckin swear word //Generate a heckin swear word
func getSwear(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) { func getSwear(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) {
resp := "" resp := ""