littlelimedragon, union types

This commit is contained in:
Daniel Odendahl Jr
2018-03-23 11:10:59 +00:00
parent fa18852775
commit ed7b4cb5e1
16 changed files with 40 additions and 33 deletions
+3 -3
View File
@@ -3218,9 +3218,9 @@
"An icy handjob from an Edmonton hooker.",
"eat pant.",
"<Blank>",
"dragonfire535.",
"XiaoBot.",
"XiaoBot's public source code.",
"littlelimedragon.",
"Xiao.",
"Xiao's public source code.",
"Discord."
]
}
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class ContrastCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -35,7 +35,7 @@ module.exports = class DemotivationalPosterCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 1024 })
}
]
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class DistortCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class GlitchCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -20,7 +20,7 @@ module.exports = class GreyscaleCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class IfunnyCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class InvertCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class SepiaCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class SilhouetteCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = class TintCommand extends Command {
{
key: 'image',
prompt: 'What image would you like to edit?',
type: 'image',
type: 'image|avatar',
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
}
]
+1 -1
View File
@@ -16,7 +16,7 @@ module.exports = class DonateCommand extends Command {
run(msg) {
return msg.say(stripIndents`
Contribute to XiaoBot development!
<https://www.patreon.com/dragonfire535>
<https://www.patreon.com/littlelimedragon>
<https://paypal.me/dragonfire535>
`);
}
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class InfoCommand extends Command {
run(msg) {
const embed = new MessageEmbed()
.setColor(0x00AE86)
.setFooter('©2017-2018 dragonfire535#8081')
.setFooter('©2017-2018 littlelimedragon#8081')
.addField(' Servers',
this.client.guilds.size, true)
.addField(' Shards',
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "70.0.0",
"version": "70.0.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
@@ -10,7 +10,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/dragonfire535/xiao.git"
"url": "git+https://github.com/littlelimedragon/xiao.git"
},
"keywords": [
"bot",
@@ -21,12 +21,12 @@
"discord-js",
"discord-js-commando"
],
"author": "dragonfire535 <danielbodendahl@gmail.com>",
"author": "littlelimedragon <danielbodendahl@gmail.com>",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/dragonfire535/xiao/issues"
"url": "https://github.com/littlelimedragon/xiao/issues"
},
"homepage": "https://github.com/dragonfire535/xiao#readme",
"homepage": "https://github.com/littlelimedragon/xiao#readme",
"engines": {
"node": ">=8.0.0"
},
@@ -48,7 +48,7 @@
"zlib-sync": "^0.1.4"
},
"devDependencies": {
"eslint": "^4.18.1",
"eslint": "^4.19.0",
"eslint-config-aqua": "^2.0.1",
"eslint-plugin-json": "^1.2.0"
},
+18
View File
@@ -0,0 +1,18 @@
const { ArgumentType } = require('discord.js-commando');
class AvatarArgumentType extends ArgumentType {
constructor(client) {
super(client, 'avatar');
}
validate(value, msg, arg) {
return this.client.types.get('user').validate(value, msg, arg);
}
async parse(value, msg, arg) {
const user = await this.client.types.get('user').parse(value, msg, arg);
return user.displayAvatarURL({ format: 'png', size: 512 });
}
}
module.exports = AvatarArgumentType;
+1 -12
View File
@@ -7,27 +7,16 @@ class ImageArgumentType extends ArgumentType {
async validate(value, msg) {
const attachment = msg.attachments.first();
if (!attachment) {
const valid = await this.client.registry.types.get('user').validate(value, msg);
return valid;
}
if (!attachment.height || !attachment.width) return false;
if (!attachment || !attachment.height || !attachment.width) return false;
if (attachment.size > 8e+6) return 'Please provide an image under 8 MB.';
return true;
}
parse(value, msg) {
if (!msg.attachments.size) {
return this.client.registry.types.get('user').parse(value, msg).displayAvatarURL({
format: 'png',
size: 512
});
}
return msg.attachments.first().url;
}
isEmpty(value, msg) {
if (!msg.attachments.size) return !value;
return !msg.attachments.size;
}
}