From a5d3cad00bbbacc3e2386a89671c246371bb0fbc Mon Sep 17 00:00:00 2001 From: qwerinope Date: Sun, 13 Apr 2025 17:58:30 +0200 Subject: [PATCH] fix revive system, fix iteminfo, add revives to README --- README.md | 2 ++ src/commands/iteminfo.ts | 2 +- src/items/revives.ts | 4 ++-- src/lib/timeoutHelper.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1503735..03521a2 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ ITEM|FUNCTION|ALIASES -|-|- `blaster {target}`|Times the target user out for 60 seconds|`!blast, !blaster` `silverbullet {target}`|Times the target user out for 24 hours|`!execute, !silverbullet` +`revive {target}`|Reduce timeout timer of target by 30 seconds|`!revive, !heal` +`superrevive {target}`|Reduce timeout timer of target by 12|`!superrevive, !superheal` `grenade`|Times a random chatter out for 60 seconds|`!grenade` `tnt`|Times out 1 to 10 chatters for 60 seconds|`!tnt` `lootbox`|Gives the user some qbucks, and possibly some items|`!lootbox` diff --git a/src/commands/iteminfo.ts b/src/commands/iteminfo.ts index 14a0243..b056123 100644 --- a/src/commands/iteminfo.ts +++ b/src/commands/iteminfo.ts @@ -5,5 +5,5 @@ export default createBotCommand('iteminfo', async (params, { say }) => { if (params[0] === undefined) { await say('No item specified!'); return } const selection = items.find(item => item.aliases.includes(params[0].toLowerCase())) if (!selection) { await say('Item not found'); return } - await say(selection[1].description) + await say(selection.description) }, { aliases: ['item'] }) diff --git a/src/items/revives.ts b/src/items/revives.ts index 14945c3..3c5bf84 100644 --- a/src/items/revives.ts +++ b/src/items/revives.ts @@ -9,7 +9,7 @@ export const revive = { prettyname: 'Revive', aliases: ['revive', 'heal'], plural: 's', - description: "", + description: "Use: revive {target}, Function: Reduce timeout timer of target by 30 seconds. Aliases: !revive, !heal", execute: async (user: HelixUser, say: (arg0: string) => Promise, broadcasterId: string, targetname: string) => { const target = await api.users.getUserByName(targetname) @@ -43,7 +43,7 @@ export const superrevive = { prettyname: 'Super Revive', aliases: ['superrevive', 'superheal'], plural: 's', - description: "", + description: "Use: superrevive {target}, Function: Reduce timeout timer of target by 12 hours. Aliases: !superrevive, !superheal", execute: async (user: HelixUser, say: (arg0: string) => Promise, broadcasterId: string, targetname: string) => { const target = await api.users.getUserByName(targetname) diff --git a/src/lib/timeoutHelper.ts b/src/lib/timeoutHelper.ts index c9cf5b1..713cf52 100644 --- a/src/lib/timeoutHelper.ts +++ b/src/lib/timeoutHelper.ts @@ -43,7 +43,7 @@ export async function reviveTarget(broadcasterId: string, target: HelixUser|null const tmpapi = broadcasterApi ?? api const bandata = await tmpapi.moderation.getBannedUsers(broadcasterId, { userId: target.id }) if (!bandata.data[0]) return { status: false, reason: 'notbanned' } - const newduration = (Date.parse(bandata.data[0].expiryDate?.toString()!) - Date.now()) / 1000 - duration // (timestamp to freedom - current timestamp) / 1000 (to seconds) - duration + const newduration = Math.floor((Date.parse(bandata.data[0].expiryDate?.toString()!) - Date.now()) / 1000 - duration) // (timestamp to freedom - current timestamp) / 1000 (to seconds) - duration try { if (newduration < 3) { // If the target is going to be unbanned in duration + 3 seconds, unban them anyway await tmpapi.moderation.unbanUser(broadcasterId, target)