Skip to content

Commit

Permalink
fix: Use proper channel.
Browse files Browse the repository at this point in the history
  • Loading branch information
KararTY committed Aug 17, 2021
1 parent 05ccbdf commit a1a49c8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/Services/Handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class Handler {
Promise<{ user: User, chatOwnerUser: User, profile: Profile }> {
const userModel = user instanceof User ? user : await User.query().where({ twitch_id: user.id }).first()
const chatOwnerUserModel = channel instanceof User ? channel
: await User.query().where({ twitch_id: global ? TwitchConfig.user.id : user.id }).first()
: await User.query().where({ twitch_id: global ? TwitchConfig.user.id : channel.id }).first()

let profileModel: Profile | null

Expand All @@ -512,11 +512,9 @@ class Handler {
mismatches: [],
nextRolls: DateTime.fromJSDate(new Date()),
})
} else {
if (!profileModel.enabled) {
throw this.error(MessageType.ERROR, user, channel,
`this profile is disabled.${(global || channel.name === 'befriendlier') ? ' The global profile has to be enabled via the BeFriendlier website.' : ''}`)
}
} else if (!profileModel.enabled) {
throw this.error(MessageType.ERROR, user, channel,
`this profile is disabled.${(global || channel.name === 'befriendlier') ? ' The global profile has to be enabled via the BeFriendlier website.' : ''}`)
}

return { user: userModel, chatOwnerUser: chatOwnerUserModel, profile: profileModel }
Expand Down

0 comments on commit a1a49c8

Please sign in to comment.