Skip to content

Commit

Permalink
fix: remove bot player (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc authored Dec 13, 2024
1 parent 0b57a35 commit c9125f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/database/models/player.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface PlayerAvatar {
export enum PlayerRole {
superUser = 'super user',
admin = 'admin',
bot = 'bot',
}

export interface PlayerModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export async function up() {
throw new Error(`actor ${event.actor.toString()} not found (game #${game.number})`)
}

if (a.roles.includes(PlayerRole.bot)) {
if (a.roles.includes('bot' as PlayerRole)) {
actor = 'bot' as Bot
} else {
actor = a.steamId
Expand Down
8 changes: 8 additions & 0 deletions src/migrations/002-remove-bot-player.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Remove the bot player that was previously used to indicate automatic actions - subbed-out players, closed games, etc.

import { collections } from '../database/collections'
import type { PlayerRole } from '../database/models/player.model'

export async function up() {
await collections.players.deleteOne({ roles: 'bot' as PlayerRole })
}

0 comments on commit c9125f1

Please sign in to comment.