mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
More info stuffs
This commit is contained in:
+2
-2
@@ -18,7 +18,6 @@ client.registry
|
||||
.registerDefaultTypes()
|
||||
.registerGroups([
|
||||
['util', 'Utility'],
|
||||
['user-info', 'User Info'],
|
||||
['guild-info', 'Server Info'],
|
||||
['moderation', 'Moderation'],
|
||||
['random-res', 'Random Response'],
|
||||
@@ -38,7 +37,8 @@ client.registry
|
||||
prefix: false,
|
||||
commandState: false
|
||||
})
|
||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||
.registerCommandsIn(path.join(__dirname, 'commands'))
|
||||
.registerTypesIn(path.join(__dirname, 'types'));
|
||||
|
||||
client.on('ready', () => {
|
||||
console.log(`[READY] Shard ${client.shard.id} logged in as ${client.user.tag}! (${client.user.id})`);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class EmojiImageCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'emoji-image',
|
||||
aliases: ['bigify-emoji', 'emoji-url', 'big-emoji'],
|
||||
group: 'guild-info',
|
||||
memberName: 'emoji-image',
|
||||
description: 'Responds with an emoji\'s full-scale image.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'emoji',
|
||||
prompt: 'Which emoji would you like to get the image of?',
|
||||
type: 'emoji'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { emoji }) {
|
||||
return msg.say({ files: [emoji.url] });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = class EmojiInfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'emoji-info',
|
||||
aliases: ['emoji'],
|
||||
group: 'guild-info',
|
||||
memberName: 'emoji-info',
|
||||
description: 'Responds with detailed information on an emoji.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'emoji',
|
||||
prompt: 'Which emoji would you like to get information on?',
|
||||
type: 'emoji'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { emoji }) {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.setThumbnail(emoji.url)
|
||||
.addField('❯ Name',
|
||||
emoji.name, true)
|
||||
.addField('❯ ID',
|
||||
emoji.id, true)
|
||||
.addField('❯ Creation Date',
|
||||
emoji.createdAt.toDateString(), true)
|
||||
.addField('❯ External',
|
||||
emoji.managed ? 'Yes' : 'No', true);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
@@ -1,10 +1,10 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class EmojiCommand extends Command {
|
||||
module.exports = class EmojiListCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'emoji',
|
||||
aliases: ['emojis', 'emoji-list'],
|
||||
name: 'emoji-list',
|
||||
aliases: ['emojis'],
|
||||
group: 'guild-info',
|
||||
memberName: 'emoji',
|
||||
description: 'Responds with a list of the server\'s custom emoji.',
|
||||
@@ -6,7 +6,7 @@ module.exports = class UserInfoCommand extends Command {
|
||||
super(client, {
|
||||
name: 'user-info',
|
||||
aliases: ['user', 'member', 'member-info'],
|
||||
group: 'user-info',
|
||||
group: 'guild-info',
|
||||
memberName: 'user-info',
|
||||
description: 'Responds with detailed information on a user.',
|
||||
guildOnly: true,
|
||||
@@ -5,7 +5,7 @@ module.exports = class AvatarCommand extends Command {
|
||||
super(client, {
|
||||
name: 'avatar',
|
||||
aliases: ['profile-picture', 'profile-pic'],
|
||||
group: 'user-info',
|
||||
group: 'random',
|
||||
memberName: 'avatar',
|
||||
description: 'Responds with a link to a user\'s avatar.',
|
||||
args: [
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "44.5.0",
|
||||
"version": "45.0.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
const { ArgumentType, util } = require('discord.js-commando');
|
||||
const { escapeMarkdown } = require('discord.js');
|
||||
|
||||
class EmojiArgumentType extends ArgumentType {
|
||||
constructor(client) {
|
||||
super(client, 'emoji');
|
||||
}
|
||||
|
||||
validate(value, msg) {
|
||||
const matches = value.match(/<:([a-zA-Z0-9_]+):(\d+)>/);
|
||||
if (matches) {
|
||||
const emoji = msg.client.emojis.get(matches[2]);
|
||||
if (emoji) return true;
|
||||
}
|
||||
if (!msg.guild) return false;
|
||||
const search = value.toLowerCase();
|
||||
const emojis = msg.guild.emojis.filter(emoji => emoji.name.toLowerCase() === search || emoji.id === search);
|
||||
if (!emojis.length) return false;
|
||||
if (emojis.length === 1) return true;
|
||||
return emojis.length <= 15
|
||||
? `${util.disambiguation(emojis.map(emoji => escapeMarkdown(emoji.name)), 'emojis', null)}\n`
|
||||
: 'Multiple emojis found. Please be more specific.';
|
||||
}
|
||||
|
||||
parse(value, msg) {
|
||||
const matches = value.match(/<:([a-zA-Z0-9_]+):(\d+)>/);
|
||||
if (matches) return msg.client.emojis.get(matches[2]);
|
||||
if (!msg.guild) return null;
|
||||
const search = value.toLowerCase();
|
||||
const emojis = msg.guild.emojis.filter(emoji => emoji.name.toLowerCase() === search || emoji.id === search);
|
||||
if (!emojis.length) return null;
|
||||
if (emojis.length === 1) return emojis[0];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EmojiArgumentType;
|
||||
Reference in New Issue
Block a user