mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 08:41:39 +01:00
fix revive system, fix iteminfo, add revives to README
This commit is contained in:
@@ -31,6 +31,8 @@ ITEM|FUNCTION|ALIASES
|
|||||||
-|-|-
|
-|-|-
|
||||||
`blaster {target}`|Times the target user out for 60 seconds|`!blast, !blaster`
|
`blaster {target}`|Times the target user out for 60 seconds|`!blast, !blaster`
|
||||||
`silverbullet {target}`|Times the target user out for 24 hours|`!execute, !silverbullet`
|
`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`
|
`grenade`|Times a random chatter out for 60 seconds|`!grenade`
|
||||||
`tnt`|Times out 1 to 10 chatters for 60 seconds|`!tnt`
|
`tnt`|Times out 1 to 10 chatters for 60 seconds|`!tnt`
|
||||||
`lootbox`|Gives the user some qbucks, and possibly some items|`!lootbox`
|
`lootbox`|Gives the user some qbucks, and possibly some items|`!lootbox`
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ export default createBotCommand('iteminfo', async (params, { say }) => {
|
|||||||
if (params[0] === undefined) { await say('No item specified!'); return }
|
if (params[0] === undefined) { await say('No item specified!'); return }
|
||||||
const selection = items.find(item => item.aliases.includes(params[0].toLowerCase()))
|
const selection = items.find(item => item.aliases.includes(params[0].toLowerCase()))
|
||||||
if (!selection) { await say('Item not found'); return }
|
if (!selection) { await say('Item not found'); return }
|
||||||
await say(selection[1].description)
|
await say(selection.description)
|
||||||
}, { aliases: ['item'] })
|
}, { aliases: ['item'] })
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export const revive = {
|
|||||||
prettyname: 'Revive',
|
prettyname: 'Revive',
|
||||||
aliases: ['revive', 'heal'],
|
aliases: ['revive', 'heal'],
|
||||||
plural: 's',
|
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) => {
|
execute: async (user: HelixUser, say: (arg0: string) => Promise<void>, broadcasterId: string, targetname: string) => {
|
||||||
const target = await api.users.getUserByName(targetname)
|
const target = await api.users.getUserByName(targetname)
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ export const superrevive = {
|
|||||||
prettyname: 'Super Revive',
|
prettyname: 'Super Revive',
|
||||||
aliases: ['superrevive', 'superheal'],
|
aliases: ['superrevive', 'superheal'],
|
||||||
plural: 's',
|
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) => {
|
execute: async (user: HelixUser, say: (arg0: string) => Promise<void>, broadcasterId: string, targetname: string) => {
|
||||||
const target = await api.users.getUserByName(targetname)
|
const target = await api.users.getUserByName(targetname)
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export async function reviveTarget(broadcasterId: string, target: HelixUser|null
|
|||||||
const tmpapi = broadcasterApi ?? api
|
const tmpapi = broadcasterApi ?? api
|
||||||
const bandata = await tmpapi.moderation.getBannedUsers(broadcasterId, { userId: target.id })
|
const bandata = await tmpapi.moderation.getBannedUsers(broadcasterId, { userId: target.id })
|
||||||
if (!bandata.data[0]) return { status: false, reason: 'notbanned' }
|
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 {
|
try {
|
||||||
if (newduration < 3) { // If the target is going to be unbanned in duration + 3 seconds, unban them anyway
|
if (newduration < 3) { // If the target is going to be unbanned in duration + 3 seconds, unban them anyway
|
||||||
await tmpapi.moderation.unbanUser(broadcasterId, target)
|
await tmpapi.moderation.unbanUser(broadcasterId, target)
|
||||||
|
|||||||
Reference in New Issue
Block a user