mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-20 05:41:37 +01:00
add stats command to readme, implement optional stacking timeouts, fully rework timeout management
This commit is contained in:
22
src/commands/stacking.ts
Normal file
22
src/commands/stacking.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { redis } from "bun";
|
||||
import { Command, sendMessage } from "commands";
|
||||
import { isAdmin } from "lib/admins";
|
||||
import parseCommandArgs from "lib/parseCommandArgs";
|
||||
|
||||
export default new Command('stacking', ['stacking'], 'chatter', async msg => {
|
||||
const args = parseCommandArgs(msg.messageText);
|
||||
if (!args[0] || !await isAdmin(msg.chatterId)) { await sendMessage(`Timeout stacking is currently ${await redis.exists('timeoutStacking') ? "on" : "off"}`, msg.messageId); return; };
|
||||
// Only admins can reach this part of code
|
||||
switch (args[0]) {
|
||||
case 'enable':
|
||||
case 'on':
|
||||
await redis.set('timeoutStacking', '1');
|
||||
await sendMessage('Timeout stacking is now on')
|
||||
break;
|
||||
case 'disable':
|
||||
case 'off':
|
||||
await redis.del('timeoutStacking');
|
||||
await sendMessage('Timeout stacking is now off')
|
||||
break;
|
||||
};
|
||||
}, false);
|
||||
Reference in New Issue
Block a user