Browse Source

fix possible null pointer dereference in role assignment

master
kageru 3 years ago
parent
commit
6393950694
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2
  1. 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…
Cancel
Save