Skip to content

Commit

Permalink
fix(bots): timeout user only on positive decision
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed May 21, 2024
1 parent 4a1a510 commit 676dff2
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions apps/bots/internal/messagehandler/handle_games_voteban.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,21 @@ func (c *MessageHandler) handleGamesVoteban(ctx context.Context, msg handleMessa

message = strings.ReplaceAll(message, "{targetUser}", voteEntity.TargetUserName)

if err := c.twitchActions.Ban(
ctx,
twitchactions.BanOpts{
Duration: gameEntity.TimeoutSeconds,
Reason: message,
BroadcasterID: msg.BroadcasterUserId,
UserID: voteEntity.TargetUserId,
ModeratorID: msg.DbChannel.BotID,
IsModerator: voteEntity.TargetIsMod,
AddModAfterBan: true,
},
); err != nil {
return err
if isPositive {
if err := c.twitchActions.Ban(
ctx,
twitchactions.BanOpts{
Duration: gameEntity.TimeoutSeconds,
Reason: message,
BroadcasterID: msg.BroadcasterUserId,
UserID: voteEntity.TargetUserId,
ModeratorID: msg.DbChannel.BotID,
IsModerator: voteEntity.TargetIsMod,
AddModAfterBan: true,
},
); err != nil {
return err
}
}

if err := c.twitchActions.SendMessage(
Expand Down

0 comments on commit 676dff2

Please sign in to comment.