mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 12:36:59 +01:00
fix explosives when using aliases
This commit is contained in:
@@ -18,6 +18,8 @@ for (const item of items) {
|
|||||||
break
|
break
|
||||||
case 'grenade':
|
case 'grenade':
|
||||||
case 'tnt':
|
case 'tnt':
|
||||||
|
await item.execute(user!, say, broadcasterId)
|
||||||
|
break
|
||||||
case 'lootbox':
|
case 'lootbox':
|
||||||
await item.execute(user!, say)
|
await item.execute(user!, say)
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ export async function timeout(broadcasterid: string, target: HelixUser|null, dur
|
|||||||
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 === process.env.BOT_NAME) 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.id)) return { status: false, reason: 'banned' }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (await tmpapi.moderation.checkUserMod(broadcasterid, target)) {
|
if (await tmpapi.moderation.checkUserMod(broadcasterid, target.id)) {
|
||||||
await tmpapi.moderation.removeModerator(broadcasterid, target)
|
await tmpapi.moderation.removeModerator(broadcasterid, target.id)
|
||||||
remodMod(broadcasterid, target, duration * 1000, tmpapi)
|
remodMod(broadcasterid, target, duration * 1000, tmpapi)
|
||||||
}
|
}
|
||||||
await tmpapi.moderation.banUser(broadcasterid, { duration, reason, user: target })
|
await tmpapi.moderation.banUser(broadcasterid, { duration, reason, user: target.id })
|
||||||
await DBValidation(target)
|
await DBValidation(target)
|
||||||
return { status: true, reason: '' }
|
return { status: true, reason: '' }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -50,7 +50,7 @@ export async function reviveTarget(broadcasterId: string, target: HelixUser|null
|
|||||||
if (MODS.includes(target.name)) remodMod(broadcasterId, target, 0, tmpapi)
|
if (MODS.includes(target.name)) remodMod(broadcasterId, target, 0, tmpapi)
|
||||||
return { status: true, reason: 'revived' }
|
return { status: true, reason: 'revived' }
|
||||||
} else {
|
} else {
|
||||||
await tmpapi.moderation.banUser(broadcasterId, { duration: newduration, reason: bandata.data[0].reason!, user: target })
|
await tmpapi.moderation.banUser(broadcasterId, { duration: newduration, reason: bandata.data[0].reason!, user: target.id })
|
||||||
if (MODS.includes(target.name)) remodMod(broadcasterId, target, newduration * 1000, tmpapi)
|
if (MODS.includes(target.name)) remodMod(broadcasterId, target, newduration * 1000, tmpapi)
|
||||||
return { status: true, reason: 'healed' }
|
return { status: true, reason: 'healed' }
|
||||||
}
|
}
|
||||||
@@ -78,11 +78,11 @@ function remodMod(broadcasterid: string, target: HelixUser, duration: number, ap
|
|||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
const bandata = await api.moderation.getBannedUsers(broadcasterid, { userId: target.id })
|
const bandata = await api.moderation.getBannedUsers(broadcasterid, { userId: target.id })
|
||||||
if (bandata.data.length !== 0) {
|
if (bandata.data.length !== 0) {
|
||||||
const timeoutleft = Date.parse(bandata.data[0].expiryDate?.toString()!) - Date.now() + 3000 // date when timeout expires - current date + 3 seconds constant
|
const timeoutleft = Date.parse(bandata.data[0].expiryDate?.toString()!) - Date.now() // date when timeout expires - current date + 3 seconds constant
|
||||||
remodMod(broadcasterid, target, timeoutleft, api) // Call the current function with new time (recursion)
|
remodMod(broadcasterid, target, timeoutleft, api) // Call the current function with new time (recursion)
|
||||||
} else { // If user is still timed out it doesn't try to remod the target
|
} else { // If user is still timed out it doesn't try to remod the target
|
||||||
try {
|
try {
|
||||||
await api.moderation.addModerator(broadcasterid, target)
|
await api.moderation.addModerator(broadcasterid, target.id)
|
||||||
} catch (err) { } // This triggers when the timeout got shortened. try/catch so no runtime error
|
} catch (err) { } // This triggers when the timeout got shortened. try/catch so no runtime error
|
||||||
}
|
}
|
||||||
}, duration + 3000) // callback gets called after duration of timeout + 3 seconds
|
}, duration + 3000) // callback gets called after duration of timeout + 3 seconds
|
||||||
|
|||||||
Reference in New Issue
Block a user