add magic8 command

This commit is contained in:
1e99 2025-07-23 18:57:12 +02:00
parent 9648e63adb
commit 23e5bb03d8
2 changed files with 45 additions and 2 deletions

40
src/commands/magic8.js Normal file
View file

@ -0,0 +1,40 @@
import { Command } from "./commands.js"
export default class Magic8Command extends Command {
#chat
#answers
constructor(chat) {
super("magic8")
this.#chat = chat
this.#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",
]
}
run(username, args) {
const answer = this.#answers[Math.floor(Math.random() * this.#answers.length)]
this.#chat.chat(answer)
}
}

View file

@ -14,14 +14,16 @@ import Commands from "./commands/commands.js"
import HelpCommand from "./commands/help.js"
import InfoCommand from "./commands/info.js"
import JoinDateCommand from "./commands/joindate.js"
import JoinsCommand from "./commands/joins.js"
import Magic8Command from "./commands/magic8.js"
import MOTDCommand from "./commands/motd.js"
import PingCommand from "./commands/ping.js"
import PlaytimeCommand from "./commands/playtime.js"
import SeenCommand from "./commands/seen.js"
import TPSCommand from "./commands/tps.js"
import WorstPingCommand from "./commands/worst-ping.js"
import JoinsCommand from "./commands/joins.js"
import MOTD from "./motd.js"
import MOTDCommand from "./commands/motd.js"
class Bot {
@ -102,6 +104,7 @@ class Bot {
this.#commands.register(new JoinDateCommand(this.#chat, this.#db, this.#dateFormat))
this.#commands.register(new JoinsCommand(this.#chat, this.#db))
this.#commands.register(new MOTDCommand(this.#chat, this.#db))
this.#commands.register(new Magic8Command(this.#chat))
this.#commands.register(new PingCommand(this.#chat, this.#players))
this.#commands.register(new PlaytimeCommand(this.#chat, this.#db))
this.#commands.register(new SeenCommand(this.#chat, this.#db, this.#dateFormat))