initial update

This commit is contained in:
murm 2023-03-15 10:09:09 -04:00
parent 3272429cf6
commit db9b70bf66
280 changed files with 11772 additions and 11966 deletions

View file

@ -1,43 +1,43 @@
import Command from "../../classes/command.js";
import { random } from "../../utils/misc.js";
class EightBallCommand extends Command {
static responses = [
"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"
];
async run() {
return `🎱 ${random(EightBallCommand.responses)}`;
}
static flags = [{
name: "question",
type: 3,
description: "A question you want to ask the ball"
}];
static description = "Asks the magic 8-ball a question";
static aliases = ["magicball", "magikball", "magic8ball", "magik8ball", "eightball"];
static arguments = ["{text}"];
}
import Command from "../../classes/command.js";
import { random } from "../../utils/misc.js";
class EightBallCommand extends Command {
static responses = [
"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"
];
async run() {
return `🎱 ${random(EightBallCommand.responses)}`;
}
static flags = [{
name: "question",
type: 3,
description: "A question you want to ask the ball"
}];
static description = "Asks the magic 8-ball a question";
static aliases = ["magicball", "magikball", "magic8ball", "magik8ball", "eightball"];
static arguments = ["{text}"];
}
export default EightBallCommand;

View file

@ -1,27 +1,27 @@
import { request } from "undici";
import Command from "../../classes/command.js";
class AncientCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const data = await request("https://files.projectlounge.pw/meme/", { method: "HEAD", signal: controller.signal });
clearTimeout(timeout);
return `https://files.projectlounge.pw${data.headers.location}`;
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a meme in time. Maybe try again?";
}
}
}
static description = "Gets a random ancient meme";
static aliases = ["old", "oldmeme", "badmeme"];
}
import { request } from "undici";
import Command from "../../classes/command.js";
class AncientCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const data = await request("https://files.projectlounge.pw/meme/", { method: "HEAD", signal: controller.signal });
clearTimeout(timeout);
return `https://files.projectlounge.pw${data.headers.location}`;
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a meme in time. Maybe try again?";
}
}
}
static description = "Gets a random ancient meme";
static aliases = ["old", "oldmeme", "badmeme"];
}
export default AncientCommand;

View file

@ -1,28 +1,28 @@
import { request } from "undici";
import Command from "../../classes/command.js";
class BirdCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const imageData = await request("http://shibe.online/api/birds", { signal: controller.signal });
clearTimeout(timeout);
const json = await imageData.body.json();
return json[0];
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a bird image in time. Maybe try again?";
}
}
}
static description = "Gets a random bird picture";
static aliases = ["birb", "birds", "birbs"];
}
import { request } from "undici";
import Command from "../../classes/command.js";
class BirdCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const imageData = await request("http://shibe.online/api/birds", { signal: controller.signal });
clearTimeout(timeout);
const json = await imageData.body.json();
return json[0];
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a bird image in time. Maybe try again?";
}
}
}
static description = "Gets a random bird picture";
static aliases = ["birb", "birds", "birbs"];
}
export default BirdCommand;

View file

@ -1,27 +1,27 @@
import { request } from "undici";
import Command from "../../classes/command.js";
class CatCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const data = await request("https://files.projectlounge.pw/cta/", { method: "HEAD", signal: controller.signal });
clearTimeout(timeout);
return `https://files.projectlounge.pw${data.headers.location}`;
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a cat image in time. Maybe try again?";
}
}
}
static description = "Gets a random cat picture";
static aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats", "cta"];
}
import { request } from "undici";
import Command from "../../classes/command.js";
class CatCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const data = await request("https://files.projectlounge.pw/cta/", { method: "HEAD", signal: controller.signal });
clearTimeout(timeout);
return `https://files.projectlounge.pw${data.headers.location}`;
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a cat image in time. Maybe try again?";
}
}
}
static description = "Gets a random cat picture";
static aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats", "cta"];
}
export default CatCommand;

View file

@ -1,25 +1,25 @@
import Command from "../../classes/command.js";
class DiceCommand extends Command {
async run() {
const max = this.options.max ?? parseInt(this.args[0]);
if (!max) {
return `🎲 The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
} else {
return `🎲 The dice landed on ${Math.floor(Math.random() * max) + 1}.`;
}
}
static flags = [{
name: "max",
type: 4,
description: "The maximum dice value",
min_value: 1
}];
static description = "Rolls the dice";
static aliases = ["roll", "die", "rng", "random"];
static arguments = ["{number}"];
}
import Command from "../../classes/command.js";
class DiceCommand extends Command {
async run() {
const max = this.options.max ?? parseInt(this.args[0]);
if (!max) {
return `🎲 The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
} else {
return `🎲 The dice landed on ${Math.floor(Math.random() * max) + 1}.`;
}
}
static flags = [{
name: "max",
type: 4,
description: "The maximum dice value",
min_value: 1
}];
static description = "Rolls the dice";
static aliases = ["roll", "die", "rng", "random"];
static arguments = ["{number}"];
}
export default DiceCommand;

View file

@ -1,28 +1,28 @@
import { request } from "undici";
import Command from "../../classes/command.js";
class DogCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const imageData = await request("https://dog.ceo/api/breeds/image/random", { signal: controller.signal });
clearTimeout(timeout);
const json = await imageData.body.json();
return json.message;
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a dog image in time. Maybe try again?";
}
}
}
static description = "Gets a random dog picture";
static aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"];
}
import { request } from "undici";
import Command from "../../classes/command.js";
class DogCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const imageData = await request("https://dog.ceo/api/breeds/image/random", { signal: controller.signal });
clearTimeout(timeout);
const json = await imageData.body.json();
return json.message;
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a dog image in time. Maybe try again?";
}
}
}
static description = "Gets a random dog picture";
static aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"];
}
export default DogCommand;

View file

@ -1,20 +1,20 @@
import ImageCommand from "../../classes/imageCommand.js";
class HomebrewCommand extends ImageCommand {
params() {
return {
caption: (this.options.text ?? this.args.join(" ")).toLowerCase().replaceAll("\n", " ")
};
}
static description = "Creates a Homebrew Channel edit";
static aliases = ["hbc", "brew", "wiibrew"];
static arguments = ["[text]"];
static requiresImage = false;
static requiresText = true;
static noText = "You need to provide some text to make a Homebrew Channel edit!";
static command = "homebrew";
}
import ImageCommand from "../../classes/imageCommand.js";
class HomebrewCommand extends ImageCommand {
params() {
return {
caption: (this.options.text ?? this.args.join(" ")).toLowerCase().replaceAll("\n", " ")
};
}
static description = "Creates a Homebrew Channel edit";
static aliases = ["hbc", "brew", "wiibrew"];
static arguments = ["[text]"];
static requiresImage = false;
static requiresText = true;
static noText = "You need to provide some text to make a Homebrew Channel edit!";
static command = "homebrew";
}
export default HomebrewCommand;

View file

@ -1,22 +1,22 @@
//import wrap from "../../utils/wrap.js";
import ImageCommand from "../../classes/imageCommand.js";
import { cleanMessage } from "../../utils/misc.js";
class SonicCommand extends ImageCommand {
params() {
const cleanedMessage = cleanMessage(this.message ?? this.interaction, this.options.text ?? this.args.join(" "));
return {
text: cleanedMessage
};
}
static description = "Creates a Sonic speech bubble image";
static arguments = ["[text]"];
static requiresImage = false;
static requiresText = true;
static noText = "You need to provide some text to make a Sonic meme!";
static command = "sonic";
}
//import wrap from "../../utils/wrap.js";
import ImageCommand from "../../classes/imageCommand.js";
import { cleanMessage } from "../../utils/misc.js";
class SonicCommand extends ImageCommand {
params() {
const cleanedMessage = cleanMessage(this.message ?? this.interaction, this.options.text ?? this.args.join(" "));
return {
text: cleanedMessage
};
}
static description = "Creates a Sonic speech bubble image";
static arguments = ["[text]"];
static requiresImage = false;
static requiresText = true;
static noText = "You need to provide some text to make a Sonic meme!";
static command = "sonic";
}
export default SonicCommand;

View file

@ -1,34 +1,34 @@
import { request } from "undici";
import Command from "../../classes/command.js";
class WikihowCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const req = await request("https://www.wikihow.com/api.php?action=query&generator=random&prop=imageinfo&format=json&iiprop=url&grnnamespace=6", { signal: controller.signal });
clearTimeout(timeout);
const json = await req.body.json();
const id = Object.keys(json.query.pages)[0];
const data = json.query.pages[id];
if (data.imageinfo) {
return json.query.pages[id].imageinfo[0].url;
} else {
return await this.run();
}
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a WikiHow image in time. Maybe try again?";
}
}
}
static description = "Gets a random WikiHow image";
static aliases = ["wiki"];
}
export default WikihowCommand;
import { request } from "undici";
import Command from "../../classes/command.js";
class WikihowCommand extends Command {
async run() {
await this.acknowledge();
const controller = new AbortController();
const timeout = setTimeout(() => {
controller.abort();
}, 15000);
try {
const req = await request("https://www.wikihow.com/api.php?action=query&generator=random&prop=imageinfo&format=json&iiprop=url&grnnamespace=6", { signal: controller.signal });
clearTimeout(timeout);
const json = await req.body.json();
const id = Object.keys(json.query.pages)[0];
const data = json.query.pages[id];
if (data.imageinfo) {
return json.query.pages[id].imageinfo[0].url;
} else {
return await this.run();
}
} catch (e) {
if (e.name === "AbortError") {
this.success = false;
return "I couldn't get a WikiHow image in time. Maybe try again?";
}
}
}
static description = "Gets a random WikiHow image";
static aliases = ["wiki"];
}
export default WikihowCommand;