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