Merge branch 'omnibus' of https://github.com/keanuplayz/TravBot-v3 into omnibus

This commit is contained in:
WatDuhHekBro 2021-04-11 05:46:10 -05:00
commit 06e122931f
32 changed files with 89 additions and 72 deletions

View File

@ -30,7 +30,7 @@ export default new NamedCommand({
run: "Please provide a question.", run: "Please provide a question.",
any: new Command({ any: new Command({
description: "Question to ask the 8-ball.", description: "Question to ask the 8-ball.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, message}) {
const sender = message.author; const sender = message.author;
send(`${random(responses)} <@${sender.id}>`); send(`${random(responses)} <@${sender.id}>`);
} }

View File

@ -31,7 +31,7 @@ export default new NamedCommand({
run: ":cookie: Here's a cookie!", run: ":cookie: Here's a cookie!",
subcommands: { subcommands: {
all: new NamedCommand({ all: new NamedCommand({
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author}) {
send(`${author} gave everybody a cookie!`); send(`${author} gave everybody a cookie!`);
} }
}) })
@ -39,7 +39,7 @@ export default new NamedCommand({
id: "user", id: "user",
user: new Command({ user: new Command({
description: "User to give cookie to.", description: "User to give cookie to.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author, args}) {
const sender = author; const sender = author;
const mention: User = args[0]; const mention: User = args[0];

View File

@ -34,7 +34,7 @@ export default new NamedCommand({
}), }),
any: new RestCommand({ any: new RestCommand({
description: "See how much money someone else has by using their username.", description: "See how much money someone else has by using their username.",
async run({send, guild, channel, args, message, combined}) { async run({send, guild, channel, combined}) {
if (isAuthorized(guild, channel)) { if (isAuthorized(guild, channel)) {
const member = await getMemberByName(guild!, combined); const member = await getMemberByName(guild!, combined);
if (typeof member !== "string") send(getMoneyEmbed(member.user)); if (typeof member !== "string") send(getMoneyEmbed(member.user));

View File

@ -1,11 +1,11 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import figlet from "figlet"; import figlet from "figlet";
export default new NamedCommand({ export default new NamedCommand({
description: "Generates a figlet of your input.", description: "Generates a figlet of your input.",
run: "You have to provide input for me to create a figlet!", run: "You have to provide input for me to create a figlet!",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, combined}) {
return send( return send(
figlet.textSync(combined, { figlet.textSync(combined, {
horizontalLayout: "full" horizontalLayout: "full"

View File

@ -1,8 +1,8 @@
import {Command, NamedCommand} from "../../core"; import {NamedCommand} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Insult TravBot! >:D", description: "Insult TravBot! >:D",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, channel, author}) {
channel.startTyping(); channel.startTyping();
setTimeout(() => { setTimeout(() => {
send( send(

View File

@ -1,9 +1,9 @@
import {Command, NamedCommand, CHANNEL_TYPE} from "../../core"; import {NamedCommand, CHANNEL_TYPE} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Chooses someone to love.", description: "Chooses someone to love.",
channelType: CHANNEL_TYPE.GUILD, channelType: CHANNEL_TYPE.GUILD,
async run({send, message, channel, guild, author, client, args}) { async run({send, guild}) {
const member = guild!.members.cache.random(); const member = guild!.members.cache.random();
send(`I love ${member.nickname ?? member.user.username}!`); send(`I love ${member.nickname ?? member.user.username}!`);
} }

View File

@ -36,12 +36,12 @@ const endpoints: {sfw: {[key: string]: string}} = {
export default new NamedCommand({ export default new NamedCommand({
description: "Provides you with a random image with the selected argument.", description: "Provides you with a random image with the selected argument.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send}) {
send(`Please provide an image type. Available arguments:\n\`[${Object.keys(endpoints.sfw).join(", ")}]\`.`); send(`Please provide an image type. Available arguments:\n\`[${Object.keys(endpoints.sfw).join(", ")}]\`.`);
}, },
any: new Command({ any: new Command({
description: "Image type to send.", description: "Image type to send.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, args}) {
const arg = args[0]; const arg = args[0];
if (!(arg in endpoints.sfw)) return send("Couldn't find that endpoint!"); if (!(arg in endpoints.sfw)) return send("Couldn't find that endpoint!");
let url = new URL(`https://nekos.life/api/v2${endpoints.sfw[arg]}`); let url = new URL(`https://nekos.life/api/v2${endpoints.sfw[arg]}`);

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand} from "../../core"; import {NamedCommand} from "../../core";
import {random} from "../../lib"; import {random} from "../../lib";
const responses = [ const responses = [
@ -61,7 +61,7 @@ const responses = [
export default new NamedCommand({ export default new NamedCommand({
description: "Sends random ok message.", description: "Sends random ok message.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send}) {
send(`ok ${random(responses)}`); send(`ok ${random(responses)}`);
} }
}); });

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import {getContent} from "../../lib"; import {getContent} from "../../lib";
import {URL} from "url"; import {URL} from "url";
@ -6,7 +6,7 @@ export default new NamedCommand({
description: "OwO-ifies the input.", description: "OwO-ifies the input.",
run: "You need to specify some text to owoify.", run: "You need to specify some text to owoify.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, combined}) {
let url = new URL(`https://nekos.life/api/v2/owoify?text=${combined}`); let url = new URL(`https://nekos.life/api/v2/owoify?text=${combined}`);
const content = (await getContent(url.toString())) as any; // Apparently, the object in question is {owo: string}. const content = (await getContent(url.toString())) as any; // Apparently, the object in question is {owo: string}.
send(content.owo); send(content.owo);

View File

@ -1,8 +1,8 @@
import {Command, NamedCommand} from "../../core"; import {NamedCommand} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Initiates a celebratory stream from the bot.", description: "Initiates a celebratory stream from the bot.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, client}) {
send("This calls for a celebration!"); send("This calls for a celebration!");
client.user!.setActivity({ client.user!.setActivity({
type: "STREAMING", type: "STREAMING",

View File

@ -1,5 +1,5 @@
import {MessageEmbed} from "discord.js"; import {MessageEmbed} from "discord.js";
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Create a poll.", description: "Create a poll.",
@ -7,7 +7,7 @@ export default new NamedCommand({
run: "Please provide a question.", run: "Please provide a question.",
any: new RestCommand({ any: new RestCommand({
description: "Question for the poll.", description: "Question for the poll.",
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, message, combined}) {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setAuthor( .setAuthor(
`Poll created by ${message.author.username}`, `Poll created by ${message.author.username}`,

View File

@ -4,7 +4,7 @@ import {Random} from "../../lib";
export default new NamedCommand({ export default new NamedCommand({
description: "Ravioli ravioli...", description: "Ravioli ravioli...",
usage: "[number from 1 to 9]", usage: "[number from 1 to 9]",
async run({send, message, channel, guild, author, member, client, args}) { async run({send}) {
send({ send({
embed: { embed: {
title: "Ravioli ravioli...", title: "Ravioli ravioli...",
@ -18,7 +18,7 @@ export default new NamedCommand({
}); });
}, },
number: new Command({ number: new Command({
async run({send, message, channel, guild, author, member, client, args}) { async run({send, args}) {
const arg: number = args[0]; const arg: number = args[0];
if (arg >= 1 && arg <= 9) { if (arg >= 1 && arg <= 9) {

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
const letters: {[letter: string]: string[]} = { const letters: {[letter: string]: string[]} = {
a: "aáàảãạâấầẩẫậăắằẳẵặ".split(""), a: "aáàảãạâấầẩẫậăắằẳẵặ".split(""),
@ -34,7 +34,7 @@ let phrase = "I have no currently set phrase!";
export default new NamedCommand({ export default new NamedCommand({
description: "Transforms your text into .", description: "Transforms your text into .",
usage: "thonk ([text])", usage: "thonk ([text])",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author}) {
const msg = await send(transform(phrase)); const msg = await send(transform(phrase));
msg.createReactionCollector( msg.createReactionCollector(
(reaction, user) => { (reaction, user) => {
@ -45,7 +45,7 @@ export default new NamedCommand({
); );
}, },
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, author, combined}) {
const msg = await send(transform(combined)); const msg = await send(transform(combined));
msg.createReactionCollector( msg.createReactionCollector(
(reaction, user) => { (reaction, user) => {

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import {MessageEmbed} from "discord.js"; import {MessageEmbed} from "discord.js";
import urban from "relevant-urban"; import urban from "relevant-urban";
@ -6,7 +6,7 @@ export default new NamedCommand({
description: "Gives you a definition of the inputted word.", description: "Gives you a definition of the inputted word.",
run: "Please input a word.", run: "Please input a word.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, combined}) {
// [Bug Fix]: Use encodeURIComponent() when emojis are used: "TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters" // [Bug Fix]: Use encodeURIComponent() when emojis are used: "TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters"
urban(encodeURIComponent(combined)) urban(encodeURIComponent(combined))
.then((res) => { .then((res) => {

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
const vaporwave = (() => { const vaporwave = (() => {
const map = new Map<string, string>(); const map = new Map<string, string>();
@ -25,7 +25,7 @@ export default new NamedCommand({
description: "Transforms your text into .", description: "Transforms your text into .",
run: "You need to enter some text!", run: "You need to enter some text!",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, combined}) {
const text = getVaporwaveText(combined); const text = getVaporwaveText(combined);
if (text !== "") send(text); if (text !== "") send(text);
else send("Make sure to enter at least one valid character."); else send("Make sure to enter at least one valid character.");

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import {MessageEmbed} from "discord.js"; import {MessageEmbed} from "discord.js";
import {find} from "weather-js"; import {find} from "weather-js";
@ -6,7 +6,7 @@ export default new NamedCommand({
description: "Shows weather info of specified location.", description: "Shows weather info of specified location.",
run: "You need to provide a city.", run: "You need to provide a city.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, combined}) {
find( find(
{ {
search: combined, search: combined,

View File

@ -43,7 +43,7 @@ const registry: {[id: string]: string} = {
export default new NamedCommand({ export default new NamedCommand({
description: "Tells you who you or the specified user is.", description: "Tells you who you or the specified user is.",
aliases: ["whoami"], aliases: ["whoami"],
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author}) {
const id = author.id; const id = author.id;
if (id in registry) { if (id in registry) {
@ -54,7 +54,7 @@ export default new NamedCommand({
}, },
id: "user", id: "user",
user: new Command({ user: new Command({
async run({send, message, channel, guild, author, member, client, args}) { async run({send, args}) {
const user: User = args[0]; const user: User = args[0];
const id = user.id; const id = user.id;
@ -67,7 +67,7 @@ export default new NamedCommand({
}), }),
any: new RestCommand({ any: new RestCommand({
channelType: CHANNEL_TYPE.GUILD, channelType: CHANNEL_TYPE.GUILD,
async run({send, message, channel, guild, author, client, args, combined}) { async run({send, guild, combined}) {
const member = await getMemberByName(guild!, combined); const member = await getMemberByName(guild!, combined);
if (typeof member !== "string") { if (typeof member !== "string") {

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import * as math from "mathjs"; import * as math from "mathjs";
import {MessageEmbed} from "discord.js"; import {MessageEmbed} from "discord.js";
@ -6,7 +6,7 @@ export default new NamedCommand({
description: "Calculates a specified math expression.", description: "Calculates a specified math expression.",
run: "Please provide a calculation.", run: "Please provide a calculation.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, combined}) {
let resp; let resp;
try { try {
resp = math.evaluate(combined); resp = math.evaluate(combined);

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand} from "../../core"; import {NamedCommand} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Gives you the Github link.", description: "Gives you the Github link.",

View File

@ -1,11 +1,11 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Renames current voice channel.", description: "Renames current voice channel.",
usage: "<name>", usage: "<name>",
run: "Please provide a new voice channel name.", run: "Please provide a new voice channel name.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, message, combined}) {
const voiceChannel = message.member?.voice.channel; const voiceChannel = message.member?.voice.channel;
if (!voiceChannel) return send("You are not in a voice channel."); if (!voiceChannel) return send("You are not in a voice channel.");

View File

@ -0,0 +1,17 @@
import {NamedCommand, RestCommand} from "../../core";
import {URL} from "url";
import {getContent} from "../../lib";
export default new NamedCommand({
description: "Provides you with info from the Discord.JS docs.",
run: "You need to specify a term to query the docs with.",
any: new RestCommand({
description: "What to query the docs with.",
async run({send, args}) {
var queryString = args[0];
let url = new URL(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${queryString}`);
const content = await getContent(url.toString());
return send({embed: content});
}
})
});

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import {processEmoteQueryFormatted} from "./modules/emote-utils"; import {processEmoteQueryFormatted} from "./modules/emote-utils";
export default new NamedCommand({ export default new NamedCommand({
@ -8,7 +8,7 @@ export default new NamedCommand({
any: new RestCommand({ any: new RestCommand({
description: "The emote(s) to send.", description: "The emote(s) to send.",
usage: "<emotes...>", usage: "<emotes...>",
async run({send, guild, channel, message, args}) { async run({send, args}) {
const output = processEmoteQueryFormatted(args); const output = processEmoteQueryFormatted(args);
if (output.length > 0) send(output); if (output.length > 0) send(output);
} }

View File

@ -8,20 +8,20 @@ import moment, {utc} from "moment";
export default new NamedCommand({ export default new NamedCommand({
description: "Command to provide all sorts of info about the current server, a user, etc.", description: "Command to provide all sorts of info about the current server, a user, etc.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author, member}) {
send(await getUserInfo(author, member)); send(await getUserInfo(author, member));
}, },
subcommands: { subcommands: {
avatar: new NamedCommand({ avatar: new NamedCommand({
description: "Shows your own, or another user's avatar.", description: "Shows your own, or another user's avatar.",
usage: "(<user>)", usage: "(<user>)",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author}) {
send(author.displayAvatarURL({dynamic: true, size: 2048})); send(author.displayAvatarURL({dynamic: true, size: 2048}));
}, },
id: "user", id: "user",
user: new Command({ user: new Command({
description: "Shows your own, or another user's avatar.", description: "Shows your own, or another user's avatar.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, args}) {
send( send(
args[0].displayAvatarURL({ args[0].displayAvatarURL({
dynamic: true, dynamic: true,
@ -33,7 +33,7 @@ export default new NamedCommand({
any: new RestCommand({ any: new RestCommand({
description: "Shows another user's avatar by searching their name", description: "Shows another user's avatar by searching their name",
channelType: CHANNEL_TYPE.GUILD, channelType: CHANNEL_TYPE.GUILD,
async run({send, message, channel, guild, author, client, args, combined}) { async run({send, guild, combined}) {
const member = await getMemberByName(guild!, combined); const member = await getMemberByName(guild!, combined);
if (typeof member !== "string") { if (typeof member !== "string") {
@ -51,7 +51,7 @@ export default new NamedCommand({
}), }),
bot: new NamedCommand({ bot: new NamedCommand({
description: "Displays info about the bot.", description: "Displays info about the bot.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, guild, client}) {
const core = os.cpus()[0]; const core = os.cpus()[0];
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setColor(guild?.me?.displayHexColor || "BLUE") .setColor(guild?.me?.displayHexColor || "BLUE")
@ -94,20 +94,20 @@ export default new NamedCommand({
description: "Displays info about the current guild or another guild.", description: "Displays info about the current guild or another guild.",
usage: "(<guild name>/<guild ID>)", usage: "(<guild name>/<guild ID>)",
channelType: CHANNEL_TYPE.GUILD, channelType: CHANNEL_TYPE.GUILD,
async run({send, message, channel, guild, author, member, client, args}) { async run({send, guild}) {
send(await getGuildInfo(guild!, guild)); send(await getGuildInfo(guild!, guild));
}, },
id: "guild", id: "guild",
guild: new Command({ guild: new Command({
description: "Display info about a guild by its ID.", description: "Display info about a guild by its ID.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, guild, args}) {
const targetGuild = args[0] as Guild; const targetGuild = args[0] as Guild;
send(await getGuildInfo(targetGuild, guild)); send(await getGuildInfo(targetGuild, guild));
} }
}), }),
any: new RestCommand({ any: new RestCommand({
description: "Display info about a guild by finding its name.", description: "Display info about a guild by finding its name.",
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, guild, combined}) {
const targetGuild = getGuildByName(combined); const targetGuild = getGuildByName(combined);
if (typeof targetGuild !== "string") { if (typeof targetGuild !== "string") {
@ -122,7 +122,7 @@ export default new NamedCommand({
id: "user", id: "user",
user: new Command({ user: new Command({
description: "Displays info about mentioned user.", description: "Displays info about mentioned user.",
async run({send, message, channel, guild, author, client, args}) { async run({send, guild, args}) {
const user = args[0] as User; const user = args[0] as User;
// Transforms the User object into a GuildMember object of the current guild. // Transforms the User object into a GuildMember object of the current guild.
const member = guild?.members.resolve(args[0]); const member = guild?.members.resolve(args[0]);

View File

@ -1,8 +1,8 @@
import {Command, NamedCommand} from "../../core"; import {NamedCommand} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Gives you the invite link.", description: "Gives you the invite link.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, client, args}) {
send( send(
`https://discordapp.com/api/oauth2/authorize?client_id=${client.user!.id}&permissions=${ `https://discordapp.com/api/oauth2/authorize?client_id=${client.user!.id}&permissions=${
args[0] || 8 args[0] || 8

View File

@ -1,5 +1,5 @@
import {GuildEmoji, MessageEmbed, User} from "discord.js"; import {GuildEmoji, MessageEmbed, User} from "discord.js";
import {Command, NamedCommand, RestCommand, paginate, SendFunction} from "../../core"; import {NamedCommand, RestCommand, paginate, SendFunction} from "../../core";
import {split} from "../../lib"; import {split} from "../../lib";
import vm from "vm"; import vm from "vm";
@ -8,13 +8,13 @@ const REGEX_TIMEOUT_MS = 1000;
export default new NamedCommand({ export default new NamedCommand({
description: "Lists all emotes the bot has in it's registry,", description: "Lists all emotes the bot has in it's registry,",
usage: "<regex pattern> (-flags)", usage: "<regex pattern> (-flags)",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author, client}) {
displayEmoteList(client.emojis.cache.array(), send, author); displayEmoteList(client.emojis.cache.array(), send, author);
}, },
any: new RestCommand({ any: new RestCommand({
description: description:
"Filters emotes by via a regular expression. Flags can be added by adding a dash at the end. For example, to do a case-insensitive search, do %prefix%lsemotes somepattern -i", "Filters emotes by via a regular expression. Flags can be added by adding a dash at the end. For example, to do a case-insensitive search, do %prefix%lsemotes somepattern -i",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author, client, args}) {
// If a guild ID is provided, filter all emotes by that guild (but only if there aren't any arguments afterward) // If a guild ID is provided, filter all emotes by that guild (but only if there aren't any arguments afterward)
if (args.length === 1 && /^\d{17,}$/.test(args[0])) { if (args.length === 1 && /^\d{17,}$/.test(args[0])) {
const guildID: string = args[0]; const guildID: string = args[0];

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import {Message, Channel, TextChannel} from "discord.js"; import {Message, Channel, TextChannel} from "discord.js";
import {processEmoteQueryArray} from "./modules/emote-utils"; import {processEmoteQueryArray} from "./modules/emote-utils";
@ -8,7 +8,7 @@ export default new NamedCommand({
usage: 'react <emotes...> (<distance / message ID / "Copy ID" / "Copy Message Link">)', usage: 'react <emotes...> (<distance / message ID / "Copy ID" / "Copy Message Link">)',
run: "You need to enter some emotes first.", run: "You need to enter some emotes first.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args}) { async run({send, message, channel, guild, client, args}) {
let target: Message | undefined; let target: Message | undefined;
let distance = 1; let distance = 1;

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
export default new NamedCommand({ export default new NamedCommand({
description: "Repeats your message.", description: "Repeats your message.",
@ -6,7 +6,7 @@ export default new NamedCommand({
run: "Please provide a message for me to say!", run: "Please provide a message for me to say!",
any: new RestCommand({ any: new RestCommand({
description: "Message to repeat.", description: "Message to repeat.",
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, author, combined}) {
send(`*${author} says:*\n${combined}`); send(`*${author} says:*\n${combined}`);
} }
}) })

View File

@ -1,4 +1,4 @@
import {Command, NamedCommand, CHANNEL_TYPE} from "../../core"; import {NamedCommand, CHANNEL_TYPE} from "../../core";
import {pluralise} from "../../lib"; import {pluralise} from "../../lib";
import moment from "moment"; import moment from "moment";
import {Collection, TextChannel} from "discord.js"; import {Collection, TextChannel} from "discord.js";
@ -9,7 +9,7 @@ export default new NamedCommand({
description: description:
"Scans all text channels in the current guild and returns the number of times each emoji specific to the guild has been used. Has a cooldown of 24 hours per guild.", "Scans all text channels in the current guild and returns the number of times each emoji specific to the guild has been used. Has a cooldown of 24 hours per guild.",
channelType: CHANNEL_TYPE.GUILD, channelType: CHANNEL_TYPE.GUILD,
async run({send, message, channel, guild, author, member, client, args}) { async run({send, message, channel, guild}) {
// Test if the command is on cooldown. This isn't the strictest cooldown possible, because in the event that the bot crashes, the cooldown will be reset. But for all intends and purposes, it's a good enough cooldown. It's a per-server cooldown. // Test if the command is on cooldown. This isn't the strictest cooldown possible, because in the event that the bot crashes, the cooldown will be reset. But for all intends and purposes, it's a good enough cooldown. It's a per-server cooldown.
const startTime = Date.now(); const startTime = Date.now();
const cooldown = 86400000; // 24 hours const cooldown = 86400000; // 24 hours
@ -185,7 +185,7 @@ export default new NamedCommand({
forcereset: new NamedCommand({ forcereset: new NamedCommand({
description: "Forces the cooldown timer to reset.", description: "Forces the cooldown timer to reset.",
permission: PERMISSIONS.BOT_SUPPORT, permission: PERMISSIONS.BOT_SUPPORT,
async run({send, message, channel, guild, author, member, client, args}) { async run({send, guild}) {
lastUsedTimestamps.set(guild!.id, 0); lastUsedTimestamps.set(guild!.id, 0);
send("Reset the cooldown on `scanemotes`."); send("Reset the cooldown on `scanemotes`.");
} }

View File

@ -5,7 +5,7 @@ export default new NamedCommand({
description: "Shortens a given URL.", description: "Shortens a given URL.",
run: "Please provide a URL.", run: "Please provide a URL.",
any: new Command({ any: new Command({
async run({send, message, channel, guild, author, member, client, args}) { async run({send, args}) {
https.get("https://is.gd/create.php?format=simple&url=" + encodeURIComponent(args[0]), function (res) { https.get("https://is.gd/create.php?format=simple&url=" + encodeURIComponent(args[0]), function (res) {
var body = ""; var body = "";
res.on("data", function (chunk) { res.on("data", function (chunk) {

View File

@ -1,9 +1,9 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import {streamList} from "../../modules/streamNotifications"; import {streamList} from "../../modules/streamNotifications";
export default new NamedCommand({ export default new NamedCommand({
description: "Sets the description of your stream. You can embed links by writing `[some name](some link)`", description: "Sets the description of your stream. You can embed links by writing `[some name](some link)`",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author, member}) {
const userID = author.id; const userID = author.id;
if (streamList.has(userID)) { if (streamList.has(userID)) {
@ -22,7 +22,7 @@ export default new NamedCommand({
} }
}, },
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, author, member, combined}) {
const userID = author.id; const userID = author.id;
if (streamList.has(userID)) { if (streamList.has(userID)) {

View File

@ -1,11 +1,11 @@
import {Command, NamedCommand, RestCommand} from "../../core"; import {NamedCommand, RestCommand} from "../../core";
import moment from "moment"; import moment from "moment";
import {Storage} from "../../structures"; import {Storage} from "../../structures";
import {MessageEmbed} from "discord.js"; import {MessageEmbed} from "discord.js";
export default new NamedCommand({ export default new NamedCommand({
description: "Keep and edit your personal todo list.", description: "Keep and edit your personal todo list.",
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author}) {
const user = Storage.getUser(author.id); const user = Storage.getUser(author.id);
const embed = new MessageEmbed().setTitle(`Todo list for ${author.tag}`).setColor("BLUE"); const embed = new MessageEmbed().setTitle(`Todo list for ${author.tag}`).setColor("BLUE");
@ -23,7 +23,7 @@ export default new NamedCommand({
add: new NamedCommand({ add: new NamedCommand({
run: "You need to specify a note to add.", run: "You need to specify a note to add.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, author, combined}) {
const user = Storage.getUser(author.id); const user = Storage.getUser(author.id);
user.todoList[Date.now().toString()] = combined; user.todoList[Date.now().toString()] = combined;
Storage.save(); Storage.save();
@ -34,7 +34,7 @@ export default new NamedCommand({
remove: new NamedCommand({ remove: new NamedCommand({
run: "You need to specify a note to remove.", run: "You need to specify a note to remove.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args, combined}) { async run({send, author, combined}) {
const user = Storage.getUser(author.id); const user = Storage.getUser(author.id);
let isFound = false; let isFound = false;
@ -54,7 +54,7 @@ export default new NamedCommand({
}) })
}), }),
clear: new NamedCommand({ clear: new NamedCommand({
async run({send, message, channel, guild, author, member, client, args}) { async run({send, author}) {
const user = Storage.getUser(author.id); const user = Storage.getUser(author.id);
user.todoList = {}; user.todoList = {};
Storage.save(); Storage.save();

View File

@ -8,7 +8,7 @@ export default new NamedCommand({
any: new Command({ any: new Command({
run: "You need to enter some text to translate.", run: "You need to enter some text to translate.",
any: new RestCommand({ any: new RestCommand({
async run({send, message, channel, guild, author, member, client, args}) { async run({send, args}) {
const lang = args[0]; const lang = args[0];
const input = args.slice(1).join(" "); const input = args.slice(1).join(" ");
translate(input, { translate(input, {