mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Discord.js v14
This commit is contained in:
+3
-3
@@ -1,4 +1,4 @@
|
||||
const { Client } = require('discord.js');
|
||||
const { Client, PermissionFlagsBits } = require('discord.js');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@@ -39,7 +39,7 @@ module.exports = class CommandClient extends Client {
|
||||
if (!msg.author) return;
|
||||
|
||||
if (msg.channel.partial) msg.channel = await this.channels.fetch(msg.channel.id);
|
||||
if (msg.partial) msg = await msg.channel.messages.fetch(msg.id);
|
||||
if (msg.partial) msg = await msg.channel.messages.fetch({ message: msg.id });
|
||||
if (msg.guild && (!msg.member || msg.member.partial || !msg.guild.members.cache.has(msg.author.id))) {
|
||||
try {
|
||||
await msg.guild.members.fetch(msg.author.id);
|
||||
@@ -51,7 +51,7 @@ module.exports = class CommandClient extends Client {
|
||||
if (msg.author.bot) return;
|
||||
if (this.blacklist.user.includes(msg.author.id)) return;
|
||||
if (msg.guild && this.blacklist.guild.includes(msg.guild.id)) return;
|
||||
if (msg.guild && !msg.channel.permissionsFor(this.user).has('SEND_MESSAGES')) return;
|
||||
if (msg.guild && !msg.channel.permissionsFor(this.user).has(PermissionFlagsBits.SendMessages)) return;
|
||||
|
||||
const patternCmd = this.dispatcher.isPatternCommand(msg);
|
||||
if (patternCmd) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable */
|
||||
const { Message } = require('discord.js');
|
||||
const { Message, EmbedBuilder } = require('discord.js');
|
||||
|
||||
Reflect.defineProperty(Message.prototype, 'say', { value: function (content, options) {
|
||||
if (typeof content === 'object') return this.channel.send(content);
|
||||
@@ -23,4 +23,12 @@ Reflect.defineProperty(Message.prototype, 'reply', { value: function (content, o
|
||||
if (typeof content === 'object') return this.channel.send(content, { reply: { messageReference: this } });
|
||||
return this.channel.send({ content, ...options, reply: { messageReference: this } });
|
||||
} });
|
||||
|
||||
Reflect.defineProperty(EmbedBuilder.prototype, 'addField', { value: function (name, value, inline = false) {
|
||||
return this.addFields([{ name, value, inline }]);
|
||||
} });
|
||||
|
||||
Reflect.defineProperty(EmbedBuilder.prototype, 'addBlankField', { value: function (inline = false) {
|
||||
return this.addFields([{ name: '\u200b', value: '\u200b', inline }]);
|
||||
} });
|
||||
/* eslint-enable */
|
||||
|
||||
@@ -7,7 +7,7 @@ module.exports = class MessageArgumentType extends ArgumentType {
|
||||
|
||||
async validate(val, msg) {
|
||||
if (!/^[0-9]+$/.test(val)) return false;
|
||||
return Boolean(await msg.channel.messages.fetch(val).catch(() => null));
|
||||
return Boolean(await msg.channel.messages.fetch({ message: val }).catch(() => null));
|
||||
}
|
||||
|
||||
parse(val, msg) {
|
||||
|
||||
Reference in New Issue
Block a user