mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Illegal, Karen, better ping
This commit is contained in:
@@ -61,6 +61,7 @@ served over 10,000 servers with a uniquely devoted fanbase.
|
||||
* **fruit**: Responds with a random fruit.
|
||||
* **guess-looks**: Guesses what a user looks like.
|
||||
* **joke**: Responds with a random joke.
|
||||
* **karen**: Responds with a random image of Karen.
|
||||
* **kiss-marry-kill**: Determines who to kiss, who to marry, and who to kill.
|
||||
* **magic-conch**: Asks your question to the Magic Conch.
|
||||
* **name**: Responds with a random name, with the gender of your choice.
|
||||
@@ -218,6 +219,7 @@ served over 10,000 servers with a uniquely devoted fanbase.
|
||||
* **glitch**: Draws an image or a user's avatar but glitched.
|
||||
* **greyscale**: Draws an image or a user's avatar in greyscale.
|
||||
* **ifunny**: Draws an image with the iFunny logo.
|
||||
* **illegal**: Makes President Trump make your text illegal.
|
||||
* **invert**: Draws an image or a user's avatar but inverted.
|
||||
* **meme**: Sends a meme with the text and background of your choice.
|
||||
* **osu-signature**: Creates a card based on an osu! user's stats.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 616 KiB |
@@ -15,8 +15,7 @@ module.exports = class FaceAnalyzeCommand extends Command {
|
||||
{
|
||||
key: 'face',
|
||||
prompt: 'What face do you want to scan?',
|
||||
type: 'image',
|
||||
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
|
||||
type: 'image'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const path = require('path');
|
||||
const { shortenText } = require('../../util/Canvas');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Regular.ttf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-CJK.otf'), { family: 'Noto' });
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Noto-Emoji.ttf'), { family: 'Noto' });
|
||||
|
||||
module.exports = class IllegalCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'illegal',
|
||||
aliases: ['is-now-illegal', 'trump', 'first-order-of-business'],
|
||||
group: 'image-edit',
|
||||
memberName: 'illegal',
|
||||
description: 'Makes President Trump make your text illegal.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What should the text of the bill be?',
|
||||
type: 'string',
|
||||
parse: text => text.toUpperCase()
|
||||
},
|
||||
{
|
||||
key: 'isOrAre',
|
||||
label: 'is or are',
|
||||
prompt: 'Should the text use is or are?',
|
||||
type: 'string',
|
||||
default: 'is',
|
||||
validate: isOrAre => {
|
||||
if (['is', 'are'].includes(isOrAre.toLowerCase())) return true;
|
||||
return 'Invalid is or are, please enter either is or are.';
|
||||
},
|
||||
parse: isOrAre => isOrAre.toUpperCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text, isOrAre }) {
|
||||
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'illegal.png'));
|
||||
const canvas = createCanvas(base.width, base.height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
ctx.rotate(7 * (Math.PI / 180));
|
||||
ctx.font = '37px Noto';
|
||||
ctx.fillText(stripIndents`
|
||||
${shortenText(ctx, text, 215)}
|
||||
${isOrAre} NOW
|
||||
ILLEGAL.
|
||||
`, 690, 350);
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'illegal.png' }] });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
|
||||
module.exports = class KarenCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'karen',
|
||||
aliases: ['ayaya'],
|
||||
group: 'random',
|
||||
memberName: 'karen',
|
||||
description: 'Responds with a random image of Karen.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const karen = await randomFromImgurAlbum('3oLAP');
|
||||
return msg.say({ files: [karen] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -21,8 +21,8 @@ module.exports = class HTTPCatCommand extends Command {
|
||||
|
||||
async run(msg, { code }) {
|
||||
try {
|
||||
const { body, text } = await snekfetch.get(`https://http.cat/${code}.jpg`);
|
||||
if (text.startsWith('<!DOCTYPE html>')) return msg.say('Could not find any results.');
|
||||
const { body, headers } = await snekfetch.get(`https://http.cat/${code}.jpg`);
|
||||
if (headers['content-type'] === 'text/html') return msg.say('Could not find any results.');
|
||||
return msg.say({ files: [{ attachment: body, name: `${code}.jpg` }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
|
||||
@@ -15,8 +15,9 @@ module.exports = class PingCommand extends Command {
|
||||
|
||||
async run(msg) {
|
||||
const message = await msg.say('Pinging...');
|
||||
const ping = Math.round(message.createdTimestamp - msg.createdTimestamp);
|
||||
return message.edit(stripIndents`
|
||||
🏓 Pong! \`${Math.round(message.createdTimestamp - msg.createdTimestamp)}ms\`
|
||||
🏓 P${'o'.repeat(Math.ceil(ping / 100))}ng! \`${ping}ms\`
|
||||
Heartbeat: \`${Math.round(this.client.ping)}ms\`
|
||||
`);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "69.2.0",
|
||||
"version": "69.3.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user