Add examples

This commit is contained in:
Dragon Fire
2024-05-16 17:16:00 -04:00
parent 9d00180cb3
commit 986d5d90fb
28 changed files with 138 additions and 32 deletions
+4
View File
@@ -34,4 +34,8 @@ module.exports = class FontArgument extends Argument {
if (foundExact.size === 1) return foundExact.first();
return null;
}
example() {
return this.client.fonts.random().filenameNoExt;
}
};
+4
View File
@@ -22,4 +22,8 @@ module.exports = class ImageOrAvatarArgument extends Argument {
return this.client.registry.types.get('image').isEmpty(value, msg, arg)
&& this.client.registry.types.get('user').isEmpty(value, msg, arg);
}
example(msg, arg) {
return this.client.registry.types.get('user').example(msg, arg);
}
};
+6
View File
@@ -2,6 +2,8 @@ const Argument = require('../framework/ArgumentType');
const fileTypeRe = /\.(jpe?g|png|gif|jfif|bmp)(\?.+)?$/i;
const request = require('node-superfetch');
const validURL = require('valid-url');
const logos = require('../../assets/json/logos');
const logoKeys = Object.keys(logos);
module.exports = class ImageArgument extends Argument {
constructor(client) {
@@ -41,4 +43,8 @@ module.exports = class ImageArgument extends Argument {
if (msg.attachments.size) return false;
return !value;
}
example() {
return `<${logos[logoKeys[Math.floor(Math.random() * logoKeys.length)]]}>`;
}
};
+4
View File
@@ -21,4 +21,8 @@ module.exports = class MonthArgument extends Argument {
if (shorthand.includes(value.toLowerCase())) return shorthand.indexOf(value.toLowerCase()) + 1;
return null;
}
example() {
return months[Math.floor(Math.random() * months.length)];
}
};
+6
View File
@@ -1,4 +1,5 @@
const Argument = require('../framework/ArgumentType');
const examples = ['Pikachu', 'Bulbasaur', 'Victini', 'Flygon'];
module.exports = class PokemonArgument extends Argument {
constructor(client) {
@@ -14,4 +15,9 @@ module.exports = class PokemonArgument extends Argument {
parse(value) {
return this.client.pokemon.fetch(value);
}
example() {
if (this.client.pokemon.size) return this.client.pokemon.random().name;
return examples[Math.floor(Math.random() * examples.length)];
}
};
+4
View File
@@ -15,4 +15,8 @@ module.exports = class SherlockType extends Argument {
parse(value) {
return sherlock.parse(value);
}
example() {
return 'sleep 1 hour';
}
};
+5
View File
@@ -37,4 +37,9 @@ module.exports = class TimezoneType extends Argument {
}
return null;
}
example() {
const zones = moment.tz.names();
return zones[Math.floor(Math.random() * zones.length)];
}
};
+4
View File
@@ -15,4 +15,8 @@ module.exports = class UrlType extends Argument {
if (!validURL.isWebUri(value)) return new URL(`http://${value}`);
return new URL(value);
}
example() {
return '<https://discord.com>';
}
};