fix revive system, fix iteminfo, add revives to README

This commit is contained in:
2025-04-13 17:58:30 +02:00
parent c2fac183cd
commit a5d3cad00b
4 changed files with 6 additions and 4 deletions

View File

@@ -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`

View File

@@ -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'] })

View File

@@ -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<void>, 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<void>, broadcasterId: string, targetname: string) => {
const target = await api.users.getUserByName(targetname)

View File

@@ -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)