Report error in register command (#14)

Formatting

Signed-off-by: Etzelia <etzelia@hotmail.com>

Revise

Signed-off-by: Etzelia <etzelia@hotmail.com>

Fix register and update Drone

Signed-off-by: Etzelia <etzelia@hotmail.com>

Reviewed-on: https://git.etztech.xyz/Etzelia/sedbot/pulls/14
fix-app
Etzelia 2020-09-08 00:47:01 +02:00
parent 944e417ddb
commit e688ba4733
2 changed files with 36 additions and 4 deletions

View File

@ -16,3 +16,33 @@ steps:
image: golang:1.15 image: golang:1.15
commands: commands:
- make vet - make vet
---
kind: pipeline
name: release
trigger:
event:
- tag
steps:
- name: build
pull: always
image: golang:1.15
commands:
- make build-all
- name: gitea-release
pull: always
image: plugins/gitea-release:1
settings:
api_key:
from_secret: gitea_token
base_url: https://git.etztech.xyz
files:
- "sedbot"
- name: gitea-prune
pull: always
image: jolheiser/dgrp:latest
settings:
base: https://git.etztech.xyz
token:
from_secret: gitea_token
keep: 2

View File

@ -44,7 +44,6 @@ func init() {
} }
var nickname string var nickname string
var accepted *bool
if len(players) > 0 { if len(players) > 0 {
player := players[0] player := players[0]
@ -60,9 +59,12 @@ func init() {
nickname = player.Username nickname = player.Username
if len(apps) == 0 { if len(apps) == 0 {
apps, err = models.Application(models.NewDjangoBuilder().Eq(django.ApplicationID, player.ApplicationID)) apps, err = models.Application(models.NewDjangoBuilder().Eq(django.ApplicationID, player.ApplicationID))
if len(apps) == 0 { if err != nil {
return "Something went wrong, please contact staff", nil return "Something went wrong, please contact staff", nil
} }
if len(apps) == 0 {
return "No application found for that player", nil
}
} }
} else if len(apps) > 0 { } else if len(apps) > 0 {
if apps[0].Accepted != nil && *apps[0].Accepted { if apps[0].Accepted != nil && *apps[0].Accepted {
@ -71,7 +73,7 @@ func init() {
} else { } else {
return "No player or applications found for that username", nil return "No player or applications found for that username", nil
} }
accepted = apps[0].Accepted accepted := apps[0].Accepted
if accepted == nil { if accepted == nil {
return "Your application is still being reviewed, hang tight", nil return "Your application is still being reviewed, hang tight", nil