fix role commands
Some checks failed
CI / build (push) Has been cancelled

This commit is contained in:
Dustin Pianalto 2021-01-25 23:04:43 -09:00
parent a587a64bd9
commit 9d0d1ddd56

View File

@ -113,8 +113,8 @@ func (s guildService) GetOrCreateGuild(id string) (geeksbot.Guild, error) {
}
func (s guildService) CreateOrUpdateRole(r geeksbot.Role) (geeksbot.Role, error) {
role, err := s.Role(r.ID)
if err.Error() == `pq: duplicate key value violates unique constraint "roles_pkey"` {
role, err := s.CreateRole(r)
if err != nil && err.Error() == `pq: duplicate key value violates unique constraint "roles_pkey"` {
role, err = s.UpdateRole(r)
}
return role, err