add admin role command
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user