mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 13:36:58 +01:00
add grenades, move give command and add vulnchatters command
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { HelixUser } from "@twurple/api"
|
||||
import { getInventory, updateInventory, changeBalance } from "../lib/userHelper"
|
||||
import { timeout, addTimeoutToDB } from "./timeoutHelper"
|
||||
import { getInventory, updateInventory } from "../lib/userHelper"
|
||||
import { timeout, addTimeoutToDB, vulnerableUsers } from "./timeoutHelper"
|
||||
import api from "./api"
|
||||
|
||||
export const ITEMS = ['blaster', 'silverbullet', 'grenade', 'tnt', 'watergun', 'clipboard', 'lootbox']
|
||||
@@ -78,3 +78,20 @@ export async function useSilverBullet(broadcasterId: string, attacker: HelixUser
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function useGrenade(broadcasterId: string, attacker: HelixUser, say: (arg0: string) => Promise<void>) {
|
||||
if (vulnerableUsers.length === 0) { await say('No chatters to blow up!'); return }
|
||||
const itemResult = await changeItemCount(attacker, 'grenade')
|
||||
|
||||
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no grenades mandoooYikes'); return }
|
||||
const target = await api.users.getUserById(vulnerableUsers[Math.floor(Math.random() * vulnerableUsers.length)])
|
||||
const result = await timeout(broadcasterId, target!, 60, `You got hit by ${attacker.name}'s grenade`)
|
||||
if (result.status) {
|
||||
await say(`${target?.name} got blown up by ${attacker.name}'s grenade! mandoooGOTTEM`)
|
||||
await addTimeoutToDB(attacker, target!, 'grenade')
|
||||
} else {
|
||||
// Banned is not an option, and neither is noexist
|
||||
await say(`something went wrong mandoooYikes`)
|
||||
console.error(result.reason)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user