mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Discord.js v14
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { embedURL } = require('../../util/Util');
|
||||
const displayFmts = {
|
||||
jpg: 'JPEG',
|
||||
@@ -31,10 +31,10 @@ module.exports = class AvatarCommand extends Command {
|
||||
if (user.avatar) formats.push('jpg', 'webp');
|
||||
const format = user.avatar && user.avatar.startsWith('a_') ? 'gif' : 'png';
|
||||
if (format === 'gif') formats.push('gif');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(user.tag)
|
||||
.setDescription(
|
||||
formats.map(fmt => embedURL(displayFmts[fmt], user.displayAvatarURL({ format: fmt, size: 2048 }))).join(' | ')
|
||||
formats.map(fmt => embedURL(displayFmts[fmt], user.displayAvatarURL({ extension: fmt, size: 2048 }))).join(' | ')
|
||||
)
|
||||
.setImage(user.displayAvatarURL({ format, size: 2048 }))
|
||||
.setColor(0x00AE86);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { GuildEmoji } = require('discord.js');
|
||||
const { GuildEmoji, PermissionFlagsBits } = require('discord.js');
|
||||
const twemoji = require('twemoji-parser');
|
||||
const request = require('node-superfetch');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
@@ -16,7 +16,7 @@ module.exports = class EmojiImageCommand extends Command {
|
||||
usages: 2,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
clientPermissions: [PermissionFlagsBits.AttachFiles],
|
||||
args: [
|
||||
{
|
||||
key: 'emoji',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = class FirstMessageCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -9,7 +9,7 @@ module.exports = class FirstMessageCommand extends Command {
|
||||
group: 'info',
|
||||
memberName: 'first-message',
|
||||
description: 'Responds with the first message ever sent to a channel.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks],
|
||||
args: [
|
||||
{
|
||||
key: 'channel',
|
||||
@@ -26,13 +26,13 @@ module.exports = class FirstMessageCommand extends Command {
|
||||
}
|
||||
const messages = await channel.messages.fetch({ after: 1, limit: 1 });
|
||||
const message = messages.first();
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(message.member ? message.member.displayHexColor : 0x00AE86)
|
||||
.setThumbnail(message.author.displayAvatarURL({ format: 'png', dynamic: true }))
|
||||
.setAuthor(message.author.tag, message.author.displayAvatarURL({ format: 'png', dynamic: true }))
|
||||
.setThumbnail(message.author.displayAvatarURL({ extension: 'png' }))
|
||||
.setAuthor({ name: message.author.tag, iconURL: message.author.displayAvatarURL({ extension: 'png' }) })
|
||||
.setDescription(message.content)
|
||||
.setTimestamp(message.createdAt)
|
||||
.setFooter(`ID: ${message.id}`)
|
||||
.setFooter({ text: `ID: ${message.id}` })
|
||||
.addField('❯ Jump', `[Click Here to Jump](${message.url})`);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { EmbedBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { embedURL } = require('../../util/Util');
|
||||
const displayFmts = {
|
||||
jpg: 'JPEG',
|
||||
@@ -17,7 +17,7 @@ module.exports = class ServerIconCommand extends Command {
|
||||
memberName: 'server-icon',
|
||||
description: 'Responds with the server\'s icon.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
clientPermissions: [PermissionFlagsBits.EmbedLinks]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ module.exports = class ServerIconCommand extends Command {
|
||||
const formats = ['png', 'jpg', 'webp'];
|
||||
const format = msg.guild.icon && msg.guild.icon.startsWith('a_') ? 'gif' : 'png';
|
||||
if (format === 'gif') formats.push('gif');
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(msg.guild.name)
|
||||
.setDescription(
|
||||
formats.map(fmt => embedURL(displayFmts[fmt], msg.guild.iconURL({ format: fmt, size: 2048 }))).join(' | ')
|
||||
formats.map(fmt => embedURL(displayFmts[fmt], msg.guild.iconURL({ extension: fmt, size: 2048 }))).join(' | ')
|
||||
)
|
||||
.setImage(msg.guild.iconURL({ format, size: 2048 }))
|
||||
.setColor(0x00AE86);
|
||||
|
||||
Reference in New Issue
Block a user