mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 13:56:57 +01:00
minor bugfixes for singleusermode, added seiso command and basic item implementation
items need to check the inventory of the user themselves also !iteminfo and !use commands should be super easy to make i do wonder if there's a nicer way to create the Item objects
This commit is contained in:
@@ -17,21 +17,26 @@ export class Command {
|
||||
|
||||
import { readdir } from 'node:fs/promises';
|
||||
const commands = new Map<string, Command>;
|
||||
const intents: string[] = [];
|
||||
const commandintents: string[] = [];
|
||||
|
||||
const files = await readdir(import.meta.dir);
|
||||
for (const file of files) {
|
||||
if (!file.endsWith('.ts')) continue;
|
||||
if (file === import.meta.file) continue;
|
||||
const command: Command = await import(import.meta.dir + '/' + file.slice(0, -3)).then(a => a.default);
|
||||
intents.push(...command.requiredIntents);
|
||||
commandintents.push(...command.requiredIntents);
|
||||
for (const alias of command.aliases) {
|
||||
commands.set(alias, command); // Since it's not a primitive type the map is filled with references to the command, not the actual object
|
||||
};
|
||||
};
|
||||
|
||||
import items from "../items";
|
||||
for (const [name, item] of Array.from(items)) {
|
||||
commands.set(name, item); // As Item is basically just Command but with more parameters, this should work fine
|
||||
};
|
||||
|
||||
export default commands;
|
||||
export { intents };
|
||||
export { commandintents };
|
||||
|
||||
import { singleUserMode, chatterApi, chatterId, streamerId } from "..";
|
||||
|
||||
|
||||
15
bot/commands/seiso.ts
Normal file
15
bot/commands/seiso.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Command, sendMessage } from ".";
|
||||
import { timeout } from "../lib/timeout";
|
||||
|
||||
export default new Command('seiso', ['seiso'], ['moderator:manage:banned_users'], async (msg, user) => {
|
||||
const rand = Math.floor(Math.random() * 101);
|
||||
if (rand > 75) await sendMessage(`${rand}% seiso YAAAA`, msg.messageId);
|
||||
else if (rand > 51) await sendMessage(`${rand}% seiso POGGERS`, msg.messageId);
|
||||
else if (rand === 50) await sendMessage(`${rand}% seiso ok`, msg.messageId);
|
||||
else if (rand > 30) await sendMessage(`${rand}% seiso SWEAT`, msg.messageId);
|
||||
else if (rand > 10) await sendMessage(`${rand}% seiso catErm`, msg.messageId);
|
||||
else {
|
||||
await sendMessage(`${rand}% seiso RIPBOZO`);
|
||||
timeout(user, 'TOO YABAI!', 60);
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user