correctly respond when user is banned or otherwise not available on api

This commit is contained in:
gempir 2022-11-11 21:25:37 +01:00
parent a0db5d5939
commit 2998fbd28a
2 changed files with 11 additions and 5 deletions

View File

@ -41,8 +41,4 @@ jobs:
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(echo ${{ github.sha }} | cut -c1-4)"
- name: announce update
run: |
echo -en "PASS ${{ secrets.TMI_TOKEN }}\r\nNICK gempbot\r\nPRIVMSG #pajlada :nymnREACT $(echo '${{ github.event.head_commit.message }}' | tr '\n' ' ' | cut -c -200) github.com/gempir/justlog/commit/${{ steps.vars.outputs.sha_short }} | justlog update\r\n" | openssl s_client -connect irc.chat.twitch.tv:6697
run: echo "::set-output name=sha_short::$(echo ${{ github.sha }} | cut -c1-4)"

View File

@ -171,6 +171,11 @@ func (s *Server) fillUserids(w http.ResponseWriter, r *http.Request) (url.Values
http.Error(w, err.Error(), http.StatusInternalServerError)
return nil, err
}
if len(users) == 0 {
err := fmt.Errorf("could not find users")
http.Error(w, err.Error(), http.StatusUnprocessableEntity)
return nil, err
}
query.Set("userid", users[username].ID)
}
@ -183,6 +188,11 @@ func (s *Server) fillUserids(w http.ResponseWriter, r *http.Request) (url.Values
http.Error(w, err.Error(), http.StatusInternalServerError)
return nil, err
}
if len(users) == 0 {
err := fmt.Errorf("could not find users")
http.Error(w, err.Error(), http.StatusUnprocessableEntity)
return nil, err
}
query.Set("channelid", users[channelName].ID)
}