Browse Source

More goroutines?

master
Gregory Rudolph 4 years ago
parent
commit
d85da5989a
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 14
      main.go

14
main.go

@ -162,13 +162,15 @@ func cleanSocials(s *discordgo.Session) { @@ -162,13 +162,15 @@ func cleanSocials(s *discordgo.Session) {
config.SocialChanns = append(config.SocialChanns, "730439324675473470")
}
for _, channel := range config.SocialChanns {
messages, _ := s.ChannelMessages(channel, 100, "", "", "")
for _, message := range messages {
_, err := s.GuildMember(config.GuildID, message.Author.ID)
if err != nil {
s.ChannelMessageDelete(channel, message.ID)
go func(channel string, s *discordgo.Session) {
messages, _ := s.ChannelMessages(channel, 100, "", "", "")
for _, message := range messages {
_, err := s.GuildMember(config.GuildID, message.Author.ID)
if err != nil {
s.ChannelMessageDelete(channel, message.ID)
}
}
}
}(channel, s)
}
}

Loading…
Cancel
Save