mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 02:15:10 +02:00
Move Groups Around
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const codes = require('./currencycodes');
|
||||
|
||||
module.exports = class CurrencyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'currency',
|
||||
group: 'random',
|
||||
memberName: 'currency',
|
||||
description: 'Converts from one currency to another.',
|
||||
details: `**Codes:** ${codes.join(', ')}`,
|
||||
args: [
|
||||
{
|
||||
key: 'base',
|
||||
prompt: 'What currency code do you want to use as the base?',
|
||||
type: 'string',
|
||||
validate: base => {
|
||||
if(codes.includes(base.toUpperCase())) return true;
|
||||
return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.';
|
||||
},
|
||||
parse: base => base.toUpperCase()
|
||||
},
|
||||
{
|
||||
key: 'to',
|
||||
prompt: 'What currency code do you want to convert to?',
|
||||
type: 'string',
|
||||
validate: to => {
|
||||
if(codes.includes(to.toUpperCase())) return true;
|
||||
return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.';
|
||||
},
|
||||
parse: to => to.toUpperCase()
|
||||
},
|
||||
{
|
||||
key: 'amount',
|
||||
prompt: 'How much money should be converted? Do not use symbols.',
|
||||
type: 'integer'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { base, to, amount } = args;
|
||||
if(base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`);
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://api.fixer.io/latest?base=${base}&symbols=${to}`);
|
||||
const rate = body.rates[to];
|
||||
const converted = rate * amount;
|
||||
return msg.say(`${amount} ${base} is ${converted} ${to}.`);
|
||||
} catch(err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
[
|
||||
"AUD",
|
||||
"USD",
|
||||
"BGN",
|
||||
"BRL",
|
||||
"CAD",
|
||||
"CHF",
|
||||
"CNY",
|
||||
"CZK",
|
||||
"DKK",
|
||||
"GBP",
|
||||
"HKD",
|
||||
"HRK",
|
||||
"HUF",
|
||||
"IDR",
|
||||
"ILS",
|
||||
"INR",
|
||||
"JPY",
|
||||
"KRW",
|
||||
"MXN",
|
||||
"MYR",
|
||||
"NOK",
|
||||
"NZD",
|
||||
"PHP",
|
||||
"PLN",
|
||||
"RON",
|
||||
"RUB",
|
||||
"SEK",
|
||||
"SGD",
|
||||
"THB",
|
||||
"TRY",
|
||||
"ZAR",
|
||||
"EUR"
|
||||
]
|
||||
@@ -1,31 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const math = require('mathjs');
|
||||
|
||||
module.exports = class MathCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'math',
|
||||
group: 'random',
|
||||
memberName: 'math',
|
||||
description: 'Does math.',
|
||||
args: [
|
||||
{
|
||||
key: 'expression',
|
||||
prompt: 'What do you want to answer?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { expression } = args;
|
||||
try {
|
||||
const solved = math.eval(expression);
|
||||
return msg.say(solved)
|
||||
.catch(() => msg.say('Invalid statement.'));
|
||||
} catch(err) {
|
||||
return msg.say('Invalid statement.');
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const codes = require('./memecodes');
|
||||
|
||||
module.exports = class MemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'meme',
|
||||
group: 'random',
|
||||
memberName: 'meme',
|
||||
description: 'Sends a Meme with text of your choice, and a background of your choice.',
|
||||
details: `**Codes:** ${codes.join(', ')}`,
|
||||
args: [
|
||||
{
|
||||
key: 'type',
|
||||
prompt: 'What meme type do you want to use?',
|
||||
type: 'string',
|
||||
validate: type => {
|
||||
if(codes.includes(type.toLowerCase())) return true;
|
||||
return 'Invalid meme type. Use `help meme` to view a list of meme types.';
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'top',
|
||||
prompt: 'What should the top row of the meme to be?',
|
||||
type: 'string',
|
||||
parse: top => encodeURIComponent(top.replace(/[ ]/g, '-'))
|
||||
},
|
||||
{
|
||||
key: 'bottom',
|
||||
prompt: 'What should the bottom row of the meme to be?',
|
||||
type: 'string',
|
||||
parse: bottom => encodeURIComponent(bottom.replace(/[ ]/g, '-'))
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
if(msg.channel.type !== 'dm')
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
const { type, top, bottom } = args;
|
||||
return msg.channel.send({ files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,97 @@
|
||||
[
|
||||
"tenguy",
|
||||
"afraid",
|
||||
"older",
|
||||
"aag",
|
||||
"tried",
|
||||
"biw",
|
||||
"blb",
|
||||
"kermit",
|
||||
"bd",
|
||||
"ch",
|
||||
"cbg",
|
||||
"wonka",
|
||||
"cb",
|
||||
"keanu",
|
||||
"dsm",
|
||||
"live",
|
||||
"ants",
|
||||
"doge",
|
||||
"alwaysonbeat",
|
||||
"ermg",
|
||||
"facepalm",
|
||||
"fwp",
|
||||
"fa",
|
||||
"fbf",
|
||||
"fry",
|
||||
"hipster",
|
||||
"icanhas",
|
||||
"crazypills",
|
||||
"mw",
|
||||
"noidea",
|
||||
"regret",
|
||||
"boat",
|
||||
"hagrid",
|
||||
"sohappy",
|
||||
"captain",
|
||||
"inigo",
|
||||
"iw",
|
||||
"ackbar",
|
||||
"happening",
|
||||
"joker",
|
||||
"ive",
|
||||
"ll",
|
||||
"morpheus",
|
||||
"mb",
|
||||
"badchoice",
|
||||
"mmm",
|
||||
"jetpack",
|
||||
"red",
|
||||
"mordor",
|
||||
"oprah",
|
||||
"oag",
|
||||
"remembers",
|
||||
"philosoraptor",
|
||||
"jw",
|
||||
"patrick",
|
||||
"rollsafe",
|
||||
"sad-obama",
|
||||
"sad-clinton",
|
||||
"sadfrog",
|
||||
"sad-bush",
|
||||
"sad-biden",
|
||||
"sad-boehner",
|
||||
"saltbae",
|
||||
"sarcasticbear",
|
||||
"dwight",
|
||||
"sb",
|
||||
"ss",
|
||||
"sf",
|
||||
"dodgson",
|
||||
"money",
|
||||
"sohot",
|
||||
"nice",
|
||||
"awesome-awkward",
|
||||
"awesome",
|
||||
"awkward-awesome",
|
||||
"awkward",
|
||||
"fetch",
|
||||
"success",
|
||||
"scc",
|
||||
"ski",
|
||||
"officespace",
|
||||
"interesting",
|
||||
"toohigh",
|
||||
"bs",
|
||||
"center",
|
||||
"both",
|
||||
"winter",
|
||||
"xy",
|
||||
"buzz",
|
||||
"yodawg",
|
||||
"uno",
|
||||
"yallgot",
|
||||
"bad",
|
||||
"elf",
|
||||
"chosen"
|
||||
]
|
||||
@@ -1,54 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class TemperatureCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'temperature',
|
||||
group: 'random',
|
||||
memberName: 'temperature',
|
||||
description: 'Converts temperatures to/from Celsius, Fahrenheit, or Kelvin.',
|
||||
args: [
|
||||
{
|
||||
key: 'base',
|
||||
prompt: 'What temperature unit do you want to use as the base?',
|
||||
type: 'string',
|
||||
validate: base => {
|
||||
if(['celsius', 'fahrenheit', 'kelvin'].includes(base.toLowerCase())) return true;
|
||||
return 'Please enter either `celsius`, `fahrenheit`, or `kelvin`.';
|
||||
},
|
||||
parse: base => base.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'to',
|
||||
prompt: 'What temperature unit do you want to convert to?',
|
||||
type: 'string',
|
||||
validate: to => {
|
||||
if(['celsius', 'fahrenheit', 'kelvin'].includes(to.toLowerCase())) return true;
|
||||
return 'Please enter either `celsius`, `fahrenheit`, or `kelvin`.';
|
||||
},
|
||||
parse: to => to.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'amount',
|
||||
prompt: 'What temperature should be converted?',
|
||||
type: 'integer'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { base, to, amount } = args;
|
||||
if(base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`);
|
||||
if(base === 'celsius') {
|
||||
if(to === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`);
|
||||
if(to === 'kelvin') return msg.say(`${amount}°C is ${amount + 273.15}°K.`);
|
||||
} else if(base === 'fahrenheit') {
|
||||
if(to === 'celsius') return msg.say(`${amount}°F is ${(amount - 32) / 1.8}°C.`);
|
||||
if(to === 'kelvin') return msg.say(`${amount}°F is ${(amount + 459.67) * (5 / 9)}°K.`);
|
||||
} else if(base === 'kelvin') {
|
||||
if(to === 'celsius') return msg.say(`${amount}°K is ${amount - 273.15}°C.`);
|
||||
if(to === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user