Shields.io badge, hi

This commit is contained in:
Daniel Odendahl Jr
2018-04-11 01:08:45 +00:00
parent 0fa42950c8
commit 8226f421af
4 changed files with 72 additions and 2 deletions
+3 -1
View File
@@ -12,7 +12,7 @@ Xiao is a Discord bot coded in JavaScript with
300 commands, she is one of the most feature-filled bots out there, and formerly
served over 10,000 servers with a uniquely devoted fanbase.
## Commands (302)
## Commands (304)
### Utility:
* **prefix**: Shows or sets the command prefix.
@@ -97,6 +97,7 @@ served over 10,000 servers with a uniquely devoted fanbase.
* **eat-pant**: Eat pant.
* **give-flower**: Gives Xiao Pai a flower.
* **hello-world**: Hello world.
* **hi**: Hello.
* **isnt-joke**: Isn't joke...
* **its-joke**: It's joke!
* **lenny**: Responds with the lenny face.
@@ -241,6 +242,7 @@ served over 10,000 servers with a uniquely devoted fanbase.
* **pokemon-fusion**: Fuses two Generation I Pokémon together.
* **robohash**: Creates a robot based on the text you provide.
* **sepia**: Draws an image or a user's avatar in sepia.
* **shields-io-badge**: Creates a badge from shields.io.
* **silhouette**: Draws a silhouette of an image or a user's avatar.
* **tint**: Draws an image or a user's avatar but tinted a specific color.
+45
View File
@@ -0,0 +1,45 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
module.exports = class ShieldsIoBadgeCommand extends Command {
constructor(client) {
super(client, {
name: 'shields-io-badge',
aliases: ['shields-io', 'img-shields-io'],
group: 'image-edit',
memberName: 'shields-io-badge',
description: 'Creates a badge from shields.io.',
clientPermissions: ['ATTACH_FILES'],
args: [
{
key: 'subject',
prompt: 'What is the subject of the badge?',
type: 'string',
parse: subject => encodeURIComponent(subject.replace(/-/g, '--').replace(/_/g, '__'))
},
{
key: 'status',
prompt: 'What is the status of the badge?',
type: 'string',
parse: status => encodeURIComponent(status.replace(/-/g, '--').replace(/_/g, '__'))
},
{
key: 'color',
prompt: 'What is the color of the badge?',
type: 'string',
default: 'brightgreen'
}
]
});
}
async run(msg, { subject, status, color }) {
try {
const { body, headers } = await snekfetch.get(`https://img.shields.io/badge/${subject}-${status}-${color}.png`);
if (headers['Content-Type'] !== 'image/png') return msg.reply('Could not create the badge...');
return msg.say({ files: [{ attachment: body, name: 'badge.png' }] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+23
View File
@@ -0,0 +1,23 @@
const { Command } = require('discord.js-commando');
module.exports = class HelloWorldCommand extends Command {
constructor(client) {
super(client, {
name: 'hi',
aliases: ['hello', 'hey', 'hoi', 'hola'],
group: 'single',
memberName: 'hi',
description: 'Hello.',
clientPermissions: ['ADD_REACTIONS', 'READ_MESSAGE_HISTORY']
});
}
async run(msg) {
try {
await msg.react('👋');
return null;
} catch (err) {
return msg.reply('Hi there!');
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "71.1.0",
"version": "71.2.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {