fix possible null pointer dereference in role assignment
This commit is contained in:
parent
3cdb5418ff
commit
6393950694
12
command.go
12
command.go
@ -249,8 +249,16 @@ func echoMessage(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
}
|
||||
|
||||
func giveAgeRole(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
Member, _ := s.GuildMember(config.ServerID, m.Author.ID)
|
||||
dm, _ := s.UserChannelCreate(Member.User.ID)
|
||||
Member, err := s.GuildMember(config.ServerID, m.Author.ID)
|
||||
if err != nil {
|
||||
log.Printf("User could not be retrieved for role assignment\n%s", err)
|
||||
return
|
||||
}
|
||||
dm, err := s.UserChannelCreate(Member.User.ID)
|
||||
if err != nil {
|
||||
log.Printf("Could not reply to user\n%s", err)
|
||||
return
|
||||
}
|
||||
required := mapset.NewSetWith("416184227672096780", "416184208470310922", "416184150404628480", "416184132473847810", "440996904948465664")
|
||||
for command, role := range config.RoleCommands {
|
||||
if m.Content == command {
|
||||
|
Loading…
Reference in New Issue
Block a user