mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 09:46:57 +01:00
fix #3, now tracking cheers and cheerEvents in database, minor tweaks to existing code
This commit is contained in:
@@ -4,11 +4,12 @@ import { timeout } from "lib/timeout";
|
||||
import User from "user";
|
||||
import { getUserRecord } from "db/dbUser";
|
||||
import { createTimeoutRecord } from "db/dbTimeouts";
|
||||
import { createCheerEventRecord } from "db/dbCheerEvents";
|
||||
import { Cheer, handleNoTarget } from "cheers";
|
||||
|
||||
const ITEMNAME = 'grenade';
|
||||
|
||||
export default new Cheer(ITEMNAME, 99, async (msg, user) => {
|
||||
export default new Cheer('grenade', 99, async (msg, user) => {
|
||||
const targets = await redis.keys(`user:*:vulnerable`);
|
||||
if (targets.length === 0) { await sendMessage('No vulnerable chatters to blow up!', msg.messageId); await handleNoTarget(msg, user, ITEMNAME); return; };
|
||||
const selection = targets[Math.floor(Math.random() * targets.length)]!;
|
||||
@@ -20,6 +21,7 @@ export default new Cheer(ITEMNAME, 99, async (msg, user) => {
|
||||
timeout(target!, `You got hit by ${user.displayName}'s grenade!`, 60),
|
||||
redis.del(selection),
|
||||
sendMessage(`wybuh ${target?.displayName} got hit by ${user.displayName}'s grenade wybuh`),
|
||||
createTimeoutRecord(user, target!, ITEMNAME)
|
||||
createTimeoutRecord(user, target!, ITEMNAME),
|
||||
createCheerEventRecord(user, ITEMNAME)
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user