Skip to content

Commit

Permalink
fix(#24): handle invalid imgur client_id
Browse files Browse the repository at this point in the history
  • Loading branch information
barthofu committed Aug 19, 2022
1 parent eb21ac2 commit 36be0ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/config/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export const generalConfig: GeneralConfigType = {
simpleCommandsPrefix: '!',
ownerId: '260908777446965248',
timezone: 'Europe/Paris',
automaticUploadImagesToImgur: true,
inviteLink: 'https://www.change_invite_link_here.com',

automaticUploadImagesToImgur: false,

devs: [
'260908777446965248',
Expand Down
11 changes: 9 additions & 2 deletions src/services/ImagesUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ export class ImagesUpload {
name: imageFileName.split('')[0]
})

if (!uploadResponse.data) return
if (!uploadResponse.success ) {
this.logger.log(
'error',
`Error uploading image ${imageFileName} to imgur: ${uploadResponse.status} ${uploadResponse.data}`,
true
)
return
}

// add the image to the database
const image = new Image()
Expand All @@ -138,7 +145,7 @@ export class ImagesUpload {

}
catch (error: any) {
this.logger.log('error', error?.toString())
this.logger.log('error', error?.toString(), true)
}
}

Expand Down

0 comments on commit 36be0ca

Please sign in to comment.