Compare commits

..

No commits in common. "411f9c3ab1033c581e427610711642a8306db2bb" and "ec5064e493faf1330f467b3a0771b9a49190e0ce" have entirely different histories.

3 changed files with 0 additions and 74 deletions

View File

@ -1,66 +0,0 @@
import { Command } from "../../Command";
import crypto from "crypto";
// Possible answers
const answers = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes, definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes",
"Reply hazy, try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
`Don't count on it`,
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
];
export const magic8ball = new Command(
"magic8ball",
["magic8ball", "8ball", "8"],
"magic8ball bozo",
"magic8ball <question>",
(msg, agent) => {
/**
* Magic 8 ball command
*
* Returns a unique answer for every question asked.
*/
// Check arguments
// We're not checking for question marks since the user might think that's too much work
if (!msg.argv[1]) return `🎱 Ask me a question, dummy`;
// Hash the question (the user will get the same response for repeated questions)
// We use a predictable but unique salt (security by obscurity?)
const hash = crypto.createHash("sha-256");
hash.update("magic" + msg.argv[1] + "8ball");
// Use the question hash as the index
const hex = hash.digest("hex");
let index = parseInt(hex[0] + hex[1] + hex[2], 16);
// Make sure the index is within the bounds of the answers array
while (index >= answers.length) {
index -= answers.length;
}
while (index <= 0) {
index += answers.length;
}
// Answer the user's question
let answer = answers[index];
return `🎱 ${answer}, ${msg.p.name}`;
}
);

View File

@ -6,13 +6,11 @@ import { id } from "./commands/utility/id";
import { msg } from "./commands/utility/msg";
import { math } from "./commands/utility/math";
import { memory } from "./commands/utility/memory";
import { magic8ball } from "./commands/fun/magic8ball";
import { cursor } from "./commands/utility/cursor";
import { inventory } from "./commands/economy/inventory";
import { color } from "./commands/utility/color";
export function loadCommands() {
// cringe
const general = new CommandGroup("general", "⭐ General");
general.addCommands([help, about]);
CommandHandler.addCommandGroup(general);
@ -21,10 +19,6 @@ export function loadCommands() {
economy.addCommands([inventory]);
CommandHandler.addCommandGroup(economy);
const fun = new CommandGroup("fun", "✨ Fun");
fun.addCommands([magic8ball]);
CommandHandler.addCommandGroup(fun);
const utility = new CommandGroup("utility", "🔨 Utility");
utility.addCommands([math, memory, id, msg, cursor, color]);
CommandHandler.addCommandGroup(utility);

View File

@ -23,8 +23,6 @@ export class SwitchChatAgent extends ServiceAgent<Client> {
this.client.defaultName = this.desiredUser.name;
this.client.defaultFormattingMode = "markdown";
console.log("SwitchChat owner only mode:", config.ownerOnly);
}
public start() {