mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 08:41:39 +01:00
buncha fixes: unused items no longer get subtracted, bot can not get blasted, 3 decimal stats
This commit is contained in:
@@ -12,7 +12,7 @@ COMMAND|FUNCTION|USER|ALIASES
|
|||||||
-|-|-|-
|
-|-|-|-
|
||||||
`!balance [target]`|List write the amount of money the user or the target user has.|anyone|`!bal, !qbucks, !qweribucks`
|
`!balance [target]`|List write the amount of money the user or the target user has.|anyone|`!bal, !qbucks, !qweribucks`
|
||||||
`!inventory [target]`|Show inventory contents of user or the target user.|anyone|`!inv`
|
`!inventory [target]`|Show inventory contents of user or the target user.|anyone|`!inv`
|
||||||
`!getloot`|Give user a lootbox. This command has a cooldown that can be changed in `lootbox.ts`. You can optionally require the user to subscribe.|anyone|`None`
|
`!getloot`|Give user a lootbox. This command has a cooldown that can be changed in `lootbox.ts`.|anyone|`None`
|
||||||
`!stats [target]`|Show the stats of user or target user including users shot, TNT used and grenades lobbed.|anyone|`None`
|
`!stats [target]`|Show the stats of user or target user including users shot, TNT used and grenades lobbed.|anyone|`None`
|
||||||
`!timeout {target}`|Give the target user a timeout of 60 seconds. This requires 100 qbucks.|anyone|`None`
|
`!timeout {target}`|Give the target user a timeout of 60 seconds. This requires 100 qbucks.|anyone|`None`
|
||||||
`!use {item}`|Use a specific item. The user needs the specific item in their inventory. For items please look at the table below|anyone|`None`
|
`!use {item}`|Use a specific item. The user needs the specific item in their inventory. For items please look at the table below|anyone|`None`
|
||||||
|
|||||||
@@ -13,10 +13,8 @@ function getTimeDifference(date1: number, date2: number) {
|
|||||||
return { days, hours, minutes, seconds };
|
return { days, hours, minutes, seconds };
|
||||||
}
|
}
|
||||||
|
|
||||||
export default createBotCommand('getloot', async (_params, { reply, userId, broadcasterId }) => {
|
export default createBotCommand('getloot', async (_params, { reply, userId }) => {
|
||||||
const user = await api.users.getUserById(userId)
|
const user = await api.users.getUserById(userId)
|
||||||
// Remove the comment on the following line to only give lootboxes to subscribed users
|
|
||||||
//if (!user?.isSubscribedTo(broadcasterId)) { await reply('Subscribe to get loot :)'); return }
|
|
||||||
const data = await lootboxReady(user)
|
const data = await lootboxReady(user)
|
||||||
if (!data.result) {
|
if (!data.result) {
|
||||||
const { days, hours, minutes, seconds } = getTimeDifference(data.lastlootbox, Date.now() - COOLDOWN)
|
const { days, hours, minutes, seconds } = getTimeDifference(data.lastlootbox, Date.now() - COOLDOWN)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default createBotCommand('inv', async (params, { userName, say }) => {
|
|||||||
messagedata.push(`${item.name + (item.amount === 1 ? '' : item.plural)}: ${item.amount}`)
|
messagedata.push(`${item.name + (item.amount === 1 ? '' : item.plural)}: ${item.amount}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messagedata.length === 0) {await say(`${data.me ? userName : params[0]} has no items mandoooYikes`); return}
|
if (messagedata.length === 0) {await say(`${data.me ? userName : params[0]} has no items!`); return}
|
||||||
|
|
||||||
await say(`
|
await say(`
|
||||||
inventory of ${data.me ? userName : params[0]}:
|
inventory of ${data.me ? userName : params[0]}:
|
||||||
|
|||||||
@@ -5,23 +5,23 @@ export default createBotCommand('iteminfo', async (params, { say }) => {
|
|||||||
let message = ''
|
let message = ''
|
||||||
switch (params[0].toLowerCase()) {
|
switch (params[0].toLowerCase()) {
|
||||||
case 'blaster':
|
case 'blaster':
|
||||||
message = "Item: blaster {target}, Function: Times the target user out for 60 seconds. Aliases: !blast, !blaster"
|
message = "Use: blaster {target}, Function: Times the target user out for 60 seconds. Aliases: !blast, !blaster"
|
||||||
break
|
break
|
||||||
case 'silver':
|
case 'silver':
|
||||||
case 'silverbullet':
|
case 'silverbullet':
|
||||||
message = "`Item: silverbullet {target}, Function: Times the target user out for 24 hours. Aliases: !execute, !silverbullet"
|
message = "Use: silverbullet {target}, Function: Times the target user out for 24 hours. Aliases: !execute, !silverbullet"
|
||||||
break
|
break
|
||||||
case 'grenade':
|
case 'grenade':
|
||||||
message = "Item: grenade, Function: Times a random chatter out for 60 seconds. Aliases: !grenade"
|
message = "Use: grenade, Function: Times a random chatter out for 60 seconds. Aliases: !grenade"
|
||||||
break
|
break
|
||||||
case 'tnt':
|
case 'tnt':
|
||||||
message = "Item: tnt, Function: Times out 1 to 10 chatters for 60 seconds. Aliases: !tnt"
|
message = "Use: tnt, Function: Times out 1 to 10 chatters for 60 seconds. Aliases: !tnt"
|
||||||
break
|
break
|
||||||
case 'lootbox':
|
case 'lootbox':
|
||||||
message = "Item: lootbox, Function: Gives the user some qbucks, and possibly some items. Aliases: !lootbox"
|
message = "Use: lootbox, Function: Gives the user some qbucks, and possibly some items. Aliases: !lootbox"
|
||||||
break
|
break
|
||||||
case 'clipboard':
|
case 'clipboard':
|
||||||
message = "Item: clipboard {message}, Function: Starts a two minute long poll with the user specified message. Aliases: !clipboard"
|
message = "Use: clipboard {message}, Function: Starts a two minute long poll with the user specified message. Aliases: !clipboard"
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
message = "Item not found"
|
message = "Item not found"
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ export default createBotCommand('balance', async (params, { userName, say }) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = await getBalance(user)
|
const data = await getBalance(user)
|
||||||
await say(`${user.name} has ${data.balance} qbucks ${data.balance === 0 ? 'mandoooYikes' : 'mandoooSmile'}`)
|
await say(`${user.name} has ${data.balance} qbucks`)
|
||||||
|
|
||||||
}, { aliases: ['qbucks', 'qweribucks', 'bal'] })
|
}, { aliases: ['qbucks', 'qweribucks', 'bal'] })
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default createBotCommand('stats', async (params, { say, userName }) => {
|
|||||||
`
|
`
|
||||||
Stats of ${data.me ? userName : params[0]}:
|
Stats of ${data.me ? userName : params[0]}:
|
||||||
Users blasted: ${data.stats.shot.blaster},
|
Users blasted: ${data.stats.shot.blaster},
|
||||||
Blasted by others: ${data.stats.hit.blaster} (${isNaN(KD) ? 0 : KD} K/D).
|
Blasted by others: ${data.stats.hit.blaster} (${isNaN(KD) ? 0 : KD.toFixed(3)} K/D).
|
||||||
Grenades lobbed: ${data.stats.used.grenade}
|
Grenades lobbed: ${data.stats.used.grenade}
|
||||||
TNTs lit: ${data.stats.used.tnt},
|
TNTs lit: ${data.stats.used.tnt},
|
||||||
Silver bullets fired: ${data.stats.shot.silverbullet},
|
Silver bullets fired: ${data.stats.shot.silverbullet},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default createBotCommand('timeout', async (params, { say, broadcasterId,
|
|||||||
const target = await api.users.getUserByName(params[0].replace(/[@]/g, ''))
|
const target = await api.users.getUserByName(params[0].replace(/[@]/g, ''))
|
||||||
const status = await timeout(broadcasterId, target!, 60, `You got blasted by ${userName}`)
|
const status = await timeout(broadcasterId, target!, 60, `You got blasted by ${userName}`)
|
||||||
if (status.status) {
|
if (status.status) {
|
||||||
await say(`${params[0]} got blasted by ${userName}! mandoooGOTTEM ${userName} now has ${userbal.balance - 100} qbucks remaining`)
|
await say(`${params[0]} got blasted by ${userName}! ${userName} now has ${userbal.balance - 100} qbucks remaining`)
|
||||||
await changeBalance(attacker!, -100)
|
await changeBalance(attacker!, -100)
|
||||||
await addTimeoutToDB(attacker!, target!, 'blaster')
|
await addTimeoutToDB(attacker!, target!, 'blaster')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ export default createBotCommand('use', async (params, { say, broadcasterId, user
|
|||||||
await useClipboard(broadcasterId, user!, params.slice(1).join(' '), say)
|
await useClipboard(broadcasterId, user!, params.slice(1).join(' '), say)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
await say(`${params[0]} does not exist mandoooYikes`)
|
await say(`${params[0]} does not exist!`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { HelixUser } from "@twurple/api"
|
import { HelixUser } from "@twurple/api"
|
||||||
import { addUsedItem, changeBalance, getInventory, updateInventory } from "../lib/userHelper"
|
import { addUsedItem, changeBalance, getInventory, inventory, updateInventory } from "../lib/userHelper"
|
||||||
import { timeout, addTimeoutToDB, vulnerableUsers } from "./timeoutHelper"
|
import { timeout, addTimeoutToDB, vulnerableUsers } from "./timeoutHelper"
|
||||||
import api, { broadcasterApi } from "./api"
|
import api, { broadcasterApi } from "./api"
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@ interface itemChangeResult {
|
|||||||
result: boolean,
|
result: boolean,
|
||||||
reason: string
|
reason: string
|
||||||
count: number,
|
count: number,
|
||||||
|
inv?: inventory
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeItemCount(user: HelixUser, item: string, amount = -1): Promise<itemChangeResult> {
|
export async function changeItemCount(user: HelixUser, item: string, amount = -1): Promise<itemChangeResult> {
|
||||||
@@ -21,9 +22,10 @@ export async function changeItemCount(user: HelixUser, item: string, amount = -1
|
|||||||
Object.defineProperty(inv, item, {
|
Object.defineProperty(inv, item, {
|
||||||
value: newcount,
|
value: newcount,
|
||||||
})
|
})
|
||||||
await updateInventory(user, inv)
|
|
||||||
await addUsedItem(user, item)
|
if (amount > 0) await updateInventory(user, inv)
|
||||||
return { result: true, reason: '', count: inv[item] }
|
|
||||||
|
return { result: true, reason: '', count: inv[item], inv }
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function useBlaster(broadcasterId: string, attacker: HelixUser, targetname: string, say: (arg0: string) => Promise<void>) {
|
export async function useBlaster(broadcasterId: string, attacker: HelixUser, targetname: string, say: (arg0: string) => Promise<void>) {
|
||||||
@@ -31,12 +33,14 @@ export async function useBlaster(broadcasterId: string, attacker: HelixUser, tar
|
|||||||
|
|
||||||
const itemResult = await changeItemCount(attacker, 'blaster')
|
const itemResult = await changeItemCount(attacker, 'blaster')
|
||||||
|
|
||||||
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no blasters mandoooYikes'); return }
|
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no blasters!'); return }
|
||||||
|
|
||||||
const result = await timeout(broadcasterId, target!, 60, `You got blasted by ${attacker.name}`)
|
const result = await timeout(broadcasterId, target!, 60, `You got blasted by ${attacker.name}`)
|
||||||
if (result.status) {
|
if (result.status) {
|
||||||
await say(`${targetname} got blasted by ${attacker.name}! mandoooGOTTEM ${attacker.name} has ${itemResult.count} blaster${itemResult.count === 1 ? '' : 's'} remaining`)
|
await say(`${targetname} got blasted by ${attacker.name}! ${attacker.name} has ${itemResult.count} blaster${itemResult.count === 1 ? '' : 's'} remaining`)
|
||||||
await addTimeoutToDB(attacker, target!, 'blaster')
|
await addTimeoutToDB(attacker, target!, 'blaster')
|
||||||
|
await addUsedItem(attacker, 'blaster')
|
||||||
|
await updateInventory(attacker, itemResult.inv!)
|
||||||
} else {
|
} else {
|
||||||
switch (result.reason) {
|
switch (result.reason) {
|
||||||
case 'noexist':
|
case 'noexist':
|
||||||
@@ -57,12 +61,14 @@ export async function useSilverBullet(broadcasterId: string, attacker: HelixUser
|
|||||||
const target = await api.users.getUserByName(targetname)
|
const target = await api.users.getUserByName(targetname)
|
||||||
|
|
||||||
const itemResult = await changeItemCount(attacker, 'silverbullet')
|
const itemResult = await changeItemCount(attacker, 'silverbullet')
|
||||||
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no silver bullets mandoooYikes'); return }
|
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no silver bullets!'); return }
|
||||||
|
|
||||||
const result = await timeout(broadcasterId, target!, 60 * 60 * 24, `You got hit by a silver bullet fired by ${attacker.name}`)
|
const result = await timeout(broadcasterId, target!, 60 * 60 * 24, `You got hit by a silver bullet fired by ${attacker.name}`)
|
||||||
if (result.status) {
|
if (result.status) {
|
||||||
await say(`${target?.name} mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute mandoooSalute `)
|
await say(`${target?.name} got deleted.`)
|
||||||
await addTimeoutToDB(attacker, target!, 'silverbullet')
|
await addTimeoutToDB(attacker, target!, 'silverbullet')
|
||||||
|
await addUsedItem(attacker, 'silverbullet')
|
||||||
|
await updateInventory(attacker, itemResult.inv!)
|
||||||
} else {
|
} else {
|
||||||
switch (result.reason) {
|
switch (result.reason) {
|
||||||
case 'noexist':
|
case 'noexist':
|
||||||
@@ -83,25 +89,26 @@ export async function useGrenade(broadcasterId: string, attacker: HelixUser, say
|
|||||||
if (vulnerableUsers.length === 0) { await say('No chatters to blow up!'); return }
|
if (vulnerableUsers.length === 0) { await say('No chatters to blow up!'); return }
|
||||||
const itemResult = await changeItemCount(attacker, 'grenade')
|
const itemResult = await changeItemCount(attacker, 'grenade')
|
||||||
|
|
||||||
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no grenades mandoooYikes'); return }
|
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no grenades!'); return }
|
||||||
const target = await api.users.getUserById(vulnerableUsers[Math.floor(Math.random() * vulnerableUsers.length)])
|
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`)
|
const result = await timeout(broadcasterId, target!, 60, `You got hit by ${attacker.name}'s grenade`)
|
||||||
if (result.status) {
|
if (result.status) {
|
||||||
await say(`${target?.name} got blown up by ${attacker.name}'s grenade! mandoooGOTTEM`)
|
await say(`${target?.name} got blown up by ${attacker.name}'s grenade!`)
|
||||||
await addTimeoutToDB(attacker, target!, 'grenade')
|
await addTimeoutToDB(attacker, target!, 'grenade')
|
||||||
|
await addUsedItem(attacker, 'grenade')
|
||||||
|
await updateInventory(attacker, itemResult.inv!)
|
||||||
} else {
|
} else {
|
||||||
// Banned is not an option, and neither is noexist
|
// Banned is not an option, and neither is noexist
|
||||||
await say(`something went wrong mandoooYikes`)
|
await say(`something went wrong`)
|
||||||
console.error(result.reason)
|
console.error(result.reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function useTNT(broadcasterId: string, attacker: HelixUser, say: (args0: string) => Promise<void>) {
|
export async function useTNT(broadcasterId: string, attacker: HelixUser, say: (args0: string) => Promise<void>) {
|
||||||
if (vulnerableUsers.length === 0) { await say('No chatters to blow up!'); return }
|
if (vulnerableUsers.length === 0) { await say('No chatters to blow up!'); return }
|
||||||
const itemResult = await changeItemCount(attacker, 'tnt')
|
const itemResult = await changeItemCount(attacker, 'tnt')
|
||||||
|
|
||||||
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no TNT mandoooYikes'); return }
|
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no TNT!'); return }
|
||||||
const min = vulnerableUsers.length < 3 ? vulnerableUsers.length : 3 //if less than 3 chatters, use that else 3
|
const min = vulnerableUsers.length < 3 ? vulnerableUsers.length : 3 //if less than 3 chatters, use that else 3
|
||||||
const max = vulnerableUsers.length > 10 ? 10 : vulnerableUsers.length //if more than 10 chatters do 10 else 10
|
const max = vulnerableUsers.length > 10 ? 10 : vulnerableUsers.length //if more than 10 chatters do 10 else 10
|
||||||
const blastedusers = Math.floor(Math.random() * (max - min + 1)) + min
|
const blastedusers = Math.floor(Math.random() * (max - min + 1)) + min
|
||||||
@@ -110,14 +117,16 @@ export async function useTNT(broadcasterId: string, attacker: HelixUser, say: (a
|
|||||||
for (const target of targets) {
|
for (const target of targets) {
|
||||||
const result = await timeout(broadcasterId, target!, 60, `You got hit by ${attacker.name}'s TNT`)
|
const result = await timeout(broadcasterId, target!, 60, `You got hit by ${attacker.name}'s TNT`)
|
||||||
if (result.status) {
|
if (result.status) {
|
||||||
await say(`${target?.name} got blown up by TNT! mandoooTNT`)
|
await say(`${target?.name} got blown up by TNT!`)
|
||||||
await addTimeoutToDB(attacker, target!, 'tnt')
|
await addTimeoutToDB(attacker, target!, 'tnt')
|
||||||
|
await addUsedItem(attacker, 'tnt')
|
||||||
|
await updateInventory(attacker, itemResult.inv!)
|
||||||
} else {
|
} else {
|
||||||
await say(`something went wrong mandoooYikes`)
|
await say(`something went wrong`)
|
||||||
console.error(result.reason)
|
console.error(result.reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await say(`${attacker.name} blew up ${blastedusers} chatters with their TNT mandoooGOTTEM ${attacker.name} has ${itemResult.count} tnt${itemResult.count === 1 ? '' : 's'} remaining`)
|
await say(`${attacker.name} blew up ${blastedusers} chatters with their TNT! ${attacker.name} has ${itemResult.count} tnt${itemResult.count === 1 ? '' : 's'} remaining`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandom(): number {
|
function getRandom(): number {
|
||||||
@@ -126,7 +135,7 @@ function getRandom(): number {
|
|||||||
|
|
||||||
export async function useLootbox(user: HelixUser, say: (arg0: string) => Promise<void>) {
|
export async function useLootbox(user: HelixUser, say: (arg0: string) => Promise<void>) {
|
||||||
const itemResult = await changeItemCount(user, 'lootbox')
|
const itemResult = await changeItemCount(user, 'lootbox')
|
||||||
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no lootboxes mandoooYikes'); return }
|
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no lootboxes!'); return }
|
||||||
// Lootbox logic will for now just be get 25 qbucks, with 50% chance to get a grenade 25% chance to get a blaster and 10% chance to get TNT
|
// Lootbox logic will for now just be get 25 qbucks, with 50% chance to get a grenade 25% chance to get a blaster and 10% chance to get TNT
|
||||||
let inventory = await getInventory(user)
|
let inventory = await getInventory(user)
|
||||||
let newitems: string[] = []
|
let newitems: string[] = []
|
||||||
@@ -135,7 +144,9 @@ export async function useLootbox(user: HelixUser, say: (arg0: string) => Promise
|
|||||||
if (getRandom() <= 50) { newitems.push('1 grenade'); inventory.grenade += 1 }
|
if (getRandom() <= 50) { newitems.push('1 grenade'); inventory.grenade += 1 }
|
||||||
if (getRandom() <= 25) { newitems.push('1 blaster'); inventory.blaster += 1 }
|
if (getRandom() <= 25) { newitems.push('1 blaster'); inventory.blaster += 1 }
|
||||||
if (getRandom() <= 10) { newitems.push('1 tnt'); inventory.tnt += 1 }
|
if (getRandom() <= 10) { newitems.push('1 tnt'); inventory.tnt += 1 }
|
||||||
|
inventory.lootbox = itemResult.inv!.lootbox
|
||||||
await updateInventory(user, inventory)
|
await updateInventory(user, inventory)
|
||||||
|
await addUsedItem(user, 'lootbox')
|
||||||
|
|
||||||
await say(`${user.name} got: ${newitems.join(' and ')}`)
|
await say(`${user.name} got: ${newitems.join(' and ')}`)
|
||||||
}
|
}
|
||||||
@@ -153,10 +164,17 @@ function shuffle(arrayold: any[]) {
|
|||||||
|
|
||||||
export async function useClipboard(broadcasterId: string, user: HelixUser, question: string, say: (arg0: string) => Promise<void>) {
|
export async function useClipboard(broadcasterId: string, user: HelixUser, question: string, say: (arg0: string) => Promise<void>) {
|
||||||
const tempapi = broadcasterApi ?? api
|
const tempapi = broadcasterApi ?? api
|
||||||
|
|
||||||
const polldata = await tempapi.polls.getPolls(broadcasterId)
|
const polldata = await tempapi.polls.getPolls(broadcasterId)
|
||||||
if (polldata.data.length > 0) {await say('Can\'t have two polls active at once.'); return}
|
const activepolldata = polldata.data.filter(poll => poll.status === "ACTIVE")
|
||||||
|
if (activepolldata.length > 0) { await say('Can\'t have two polls active at once.'); return }
|
||||||
|
|
||||||
const itemResult = await changeItemCount(user, 'clipboard')
|
const itemResult = await changeItemCount(user, 'clipboard')
|
||||||
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no clipboards mandoooYikes'); return }
|
await addUsedItem(user, 'clipboard')
|
||||||
|
await updateInventory(user, itemResult.inv!)
|
||||||
|
|
||||||
|
if (!itemResult.result && itemResult.reason === 'negative') { await say('You have no clipboards!'); return }
|
||||||
|
|
||||||
await tempapi.polls.createPoll(broadcasterId, { choices: ['Yes', 'No'], duration: 120, title: question })
|
await tempapi.polls.createPoll(broadcasterId, { choices: ['Yes', 'No'], duration: 120, title: question })
|
||||||
await say(`${user.name} used a clipboard! They have ${itemResult.count} clipboard${itemResult.count === 1 ? '' : 's'} remaining`)
|
await say(`${user.name} used a clipboard! They have ${itemResult.count} clipboard${itemResult.count === 1 ? '' : 's'} remaining`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ interface statusmessage {
|
|||||||
export async function timeout(broadcasterid: string, target: HelixUser, duration: number, reason: string): Promise<statusmessage> {
|
export async function timeout(broadcasterid: string, target: HelixUser, duration: number, reason: string): Promise<statusmessage> {
|
||||||
if (!target) return { status: false, reason: 'noexist' }
|
if (!target) return { status: false, reason: 'noexist' }
|
||||||
const tmpapi = broadcasterApi ?? api
|
const tmpapi = broadcasterApi ?? api
|
||||||
// if (target.name === 'qwerinope') return { status: false, reason: 'unknown' }
|
if (target.name === process.env.BOT_NAME) return { status: false, reason: 'unknown' }
|
||||||
if (await tmpapi.moderation.checkUserBan(broadcasterid, target)) return { status: false, reason: 'banned' }
|
if (await tmpapi.moderation.checkUserBan(broadcasterid, target)) return { status: false, reason: 'banned' }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user