add admin role command
CI / build (push) Has been cancelled

This commit is contained in:
Dustin Pianalto
2021-01-25 22:41:51 -09:00
parent cdbeac195f
commit 53276a1442
3 changed files with 43 additions and 3 deletions
+5 -3
View File
@@ -113,7 +113,9 @@ func (s guildService) GetOrCreateGuild(id string) (geeksbot.Guild, error) {
}
func (s guildService) CreateOrUpdateRole(r geeksbot.Role) (geeksbot.Role, error) {
queryString := "INSERT INTO roles (id, role_type, guild_id) VALUES ($1, $2, $3)"
_, err := s.db.Exec(queryString, r.ID, r.RoleType, r.Guild.ID)
return r, err
role, err := s.Role(r.ID)
if err.Error() == `pq: duplicate key value violates unique constraint "roles_pkey"` {
role, err = s.UpdateRole(r)
}
return role, err
}