【发布时间】:2021-06-19 09:46:09
【问题描述】:
由于某些原因,当我输入 !ticket 时,我需要帮助帮助。这可能是一个非常简单的问题,我很愚蠢地意识到它。如果您也能提供帮助,我也无法让表情符号工作,那太好了
const Discord = require("discord.js")
const ms = require('ms');
module.exports = {
name: 'ticket',
usage: '%ticket <reason>',
description: 'makes a ticket',
async execute(client, message, args, cmd, discord) {
const channel = await message.guild.channels.create(`ticket: ${message.user.tag}`);
channel.setParent('855596395783127081');
channel.updateOverwrite(message.guild.id, {
SEND_MESSAGE: false,
VEIW_CHANNEL: false
})
channel.updateOverwrite(message.auther, {
SEND_MESSAGE: true,
VEIW_CHANNEL: true
})
const reactionMessage = await channel.send(`Thank you for contacting support! A staff member will be with you as soon as possible`);
try {
await reactionMessage.react(":lock:");
await reactionMessage.react(":no_entry:");
} catch (err) {
channel.send(`Error Sending Emojis`);
throw err;
}
const collector = reactionMessage.createReactionCollector((reaction, user) =>
message.guild.member.cache.find((member) => member.id === userid).hasPermission('ADMINISTRATOR'), { dispose: true }
);
collector.on('collect', (reaction, user) => {
switch (reaction.emoji.name) {
case ":lock:":
channel.updateOverwrite(message.auther, { SEND_MESSAGE: false });
break;
case ":no_entry:":
channel.send('Deleteing ticket in 5 seconds');
setTimeout(() => channel.delete(), 5000);
break;
}
});
message.channel.send(`We will be right withyou! ${channel}`).then((msg) => {
setTimeout(() => msg.delete(), 7000)
setTimeout(() => message.delete(), 7000)
})
}
}
这是错误
PS C:\Users\lolzy\OneDrive\Desktop\discordbot> node .
Cbs slave is online!
(node:19284) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'tag' of undefined
at Object.execute (C:\Users\lolzy\OneDrive\Desktop\discordbot\commands\ticket.js:10:85)
at module.exports (C:\Users\lolzy\OneDrive\Desktop\discordbot\events\guild\message.js:10:26)
at Client.emit (events.js:376:20)
at MessageCreateAction.handle (C:\Users\lolzy\OneDrive\Desktop\discordbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\lolzy\OneDrive\Desktop\discordbot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\lolzy\OneDrive\Desktop\discordbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\lolzy\OneDrive\Desktop\discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\lolzy\OneDrive\Desktop\discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\lolzy\OneDrive\Desktop\discordbot\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:376:20)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:19284) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of
an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19284) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that
are not handled will terminate the Node.js process with a non-zero exit code.
【问题讨论】:
-
好的,它的一部分工作只需要让表情符号工作它所说的未知表情符号
标签: javascript discord.js