2021-02-22 18:27:49 +00:00
|
|
|
package discord
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2021-02-23 05:53:55 +00:00
|
|
|
commands = append(commands, &command{
|
2021-02-22 18:27:49 +00:00
|
|
|
staffOnly: true,
|
2021-02-23 05:53:55 +00:00
|
|
|
name: "unbans",
|
2021-02-22 18:27:49 +00:00
|
|
|
validate: func(cmd commandInit) bool {
|
|
|
|
return isStaff(cmd.message.Member.Roles, cmd.config.StaffRoles)
|
|
|
|
},
|
|
|
|
run: func(cmd commandInit) (string, error) {
|
|
|
|
unbans := cmd.database.ListUnbans()
|
|
|
|
if len(unbans) == 0 {
|
|
|
|
return "There are no pending unbans", nil
|
|
|
|
}
|
|
|
|
|
|
|
|
embed := &discordgo.MessageEmbed{
|
|
|
|
Fields: make([]*discordgo.MessageEmbedField, len(unbans)),
|
|
|
|
}
|
|
|
|
for i, record := range cmd.database.ListUnbans() {
|
|
|
|
embed.Fields[i] = &discordgo.MessageEmbedField{
|
|
|
|
Name: record.Username,
|
|
|
|
Value: record.ExpirationString(),
|
|
|
|
Inline: true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sendEmbed(cmd.session, cmd.message.ChannelID, embed)
|
|
|
|
return "", nil
|
|
|
|
},
|
2021-02-23 05:53:55 +00:00
|
|
|
help: "Check the unban scheduler",
|
|
|
|
})
|
2021-02-22 18:27:49 +00:00
|
|
|
}
|