allow for multiple admin users in config (fixes #2)

This commit is contained in:
kageru 2018-06-08 17:49:37 +02:00
parent eb89adc065
commit fd7a06b56d
4 changed files with 12 additions and 4 deletions

View File

@ -15,7 +15,7 @@ type Embed struct {
} }
type Config struct { type Config struct {
AdminID string Admins []string
ServerID string ServerID string
LockedRoleID string LockedRoleID string
Token string Token string

View File

@ -1,6 +1,9 @@
{ {
"Token": "your login token", "Token": "your login token",
"AdminID": "your user ID", "Admins": {
"your user ID",
"another admin ID"
},
"ServerID": "the server the bot will be running on", "ServerID": "the server the bot will be running on",
"RequireAccept": false, "RequireAccept": false,
"LockedRoleID": "the role to be given to locked users (readme)", "LockedRoleID": "the role to be given to locked users (readme)",

View File

@ -43,5 +43,10 @@ func isDM(s *discordgo.Session, m *discordgo.MessageCreate) bool {
} }
func isAdmin(u *discordgo.User) bool { func isAdmin(u *discordgo.User) bool {
return (u.ID == config.AdminID) for _, admin := range config.Admins {
if u.ID == admin {
return true
}
}
return false
} }

View File

@ -18,7 +18,7 @@ func getWelcomeEmbed() *discordgo.MessageEmbed {
}, },
&discordgo.MessageEmbedField { &discordgo.MessageEmbedField {
Name: config.WelcomeEmbed.BugsTitle, Name: config.WelcomeEmbed.BugsTitle,
Value: fmt.Sprintf(config.WelcomeEmbed.BugsText, config.AdminID), Value: fmt.Sprintf(config.WelcomeEmbed.BugsText, config.Admins[0]),
Inline: true, Inline: true,
}, },
}, },