简体   繁体   English

为什么 discord.js 清除命令没有响应?

[英]Why is discord.js purge command not responding?

I'm trying to make a discord.js bot.我正在尝试制作 discord.js 机器人。 I'm getting stuck on the purge command.我被困在清除命令上。 When I test it it either takes over a minute to respond or it doesn't work at all.当我测试它时,它要么需要一分钟多的时间才能响应,要么根本不起作用。

Javascript code: Javascript 代码:

if (!message.member.hasPermission("MANAGE_MESSAGES"))
return message.reply("You don't have permssions to do that!");
if (!args[0])
  return message.channel.send(
    "Please enter a number of messages to clear! `Usage: .clear <amount>`"
  );
const deleteNum = parseInt(args[0])
if (isNaN(deleteNum)) return message.reply('that is not a number')
message.channel.bulkDelete(deleteNum).then(() => {
  message.channel
    .send(`**__Cleared ${args[0]} messages.__**`)
    .then(msg => msg.delete(5000));
});

Is it just purge or is it all commands?它只是清除还是全部命令? If it is all commands then use this:如果是所有命令,则使用以下命令:

message.channel.send(`Latency is ${Date.now() - message.createdTimestamp}ms.`)

If the ping is high then it is an issue on your end.如果 ping 很高,那么这是您的问题。 Else, you might need to look into more efficient/better ways of doing this.否则,您可能需要寻找更有效/更好的方法来做到这一点。 If you'd like to, you can reply with your ping and if it is not the ping's fault then I'd be happy to help anymore:D如果您愿意,您可以回复您的 ping,如果不是 ping 的错,那么我很乐意再提供帮助:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM