Add social channel cleanup on member leave, but don't delete yet. Testing first!
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -106,7 +106,7 @@ func readReaction(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
|
|||||||
log.LogInfo("%+v has requested ASL for user %+v.", admin.User.Username, user.Username)
|
log.LogInfo("%+v has requested ASL for user %+v.", admin.User.Username, user.Username)
|
||||||
return
|
return
|
||||||
} else if m.Emoji.Name == "⛔" {
|
} else if m.Emoji.Name == "⛔" {
|
||||||
s.GuildBanCreateWithReason(config.GuildID, user.ID, fmt.Sprintf("Underage or too many failed verifications. %+v", admin.User.Username), 5)
|
s.GuildBanCreateWithReason(config.GuildID, user.ID, fmt.Sprintf("Underage female or too many failed verifications. %+v", admin.User.Username), 5)
|
||||||
verification.Status = "Banned"
|
verification.Status = "Banned"
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
|
|||||||
20
main.go
20
main.go
@ -151,10 +151,28 @@ func runPurge(s *discordgo.Session) {
|
|||||||
s.ChannelMessageDelete(config.MonitorChann, message.ID)
|
s.ChannelMessageDelete(config.MonitorChann, message.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
go cleanSocials(s)
|
||||||
saveConfig()
|
saveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func cleanSocials(s *discordgo.Session) {
|
||||||
|
if len(config.SocialChanns) == 0 {
|
||||||
|
config.SocialChanns = append(config.SocialChanns, "730437117913858129")
|
||||||
|
config.SocialChanns = append(config.SocialChanns, "730439200771670076")
|
||||||
|
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)
|
||||||
|
s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("Suggested delete: %+v from <#%+v>, reason: Member not found.", message.ID, channel))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func verifyMember(s *discordgo.Session, u discordgo.User) {
|
func verifyMember(s *discordgo.Session, u discordgo.User) {
|
||||||
defer log.PanicSafe()
|
defer log.PanicSafe()
|
||||||
s.GuildMemberRoleAdd(config.GuildID, u.ID, config.VerifiedRole)
|
s.GuildMemberRoleAdd(config.GuildID, u.ID, config.VerifiedRole)
|
||||||
|
|||||||
1
types.go
1
types.go
@ -32,6 +32,7 @@ type Config struct {
|
|||||||
MonitorRole string
|
MonitorRole string
|
||||||
IntroChann string
|
IntroChann string
|
||||||
MonitorChann string
|
MonitorChann string
|
||||||
|
SocialChanns []string
|
||||||
VerifiedRole string
|
VerifiedRole string
|
||||||
BumpTime time.Time
|
BumpTime time.Time
|
||||||
LastBumper string
|
LastBumper string
|
||||||
|
|||||||
Reference in New Issue
Block a user