所以我要做的是为我的不和谐机器人创建一个类似于“冷却”的系统,我尝试使用了一个数据库方法,,它对我不起作用。
我正在使用discord.js包。
下面是我的代码:
if (msg.content.startsWith("!point")) {
var usr = msg.content.split(" ").slice(1).join(" ");
if (!usr) {
bot.sendMessage(msg, "```Error: 1\n Reason: Please state a name.```");
因此,我在我的机器人中添加了@commands.cooldown(1, 10, commands.BucketType.user),试图阻止人们向它发送垃圾邮件。我将错误消息设置为: async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
await ctx.send(f'This command is not ready to use, try again in %.2f seconds' % error.retry_after
我最近启动了一个新的discord.js机器人,并得到了一个“无效令牌”错误。这不可能是因为一个异步函数,因为我只启动了bot并且有0条命令,上一次发生这种情况是当我试图在heroku.i上托管另一个bot时,我还没有找到解决方案,这是我的终端:
C:\Users\Lory\Desktop\pp>node .
(node:3760) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (C:\Users
我刚刚开始从事discord.js的工作,我不知道很多事情。我向机器人添加了一段代码,该代码应生成一个链接,邀请它访问服务器并将其发送到控制台。但是,发出的不是链接,而是以下错误: D:\Discord Shield\node_modules\discord.js\src\client\Client.js:488
throw new TypeError('INVITE_MISSING_SCOPES');
^
TypeError [INVITE_MISSING_SCOPES]: At least one valid scope must be prov
我有一个不和谐的机器人(实际上是两个,一个在python中),我使用我的raspberry pi 4 4gb的ram模型运行。我这样做是为了在启动时(通过crontab)自动执行js和python脚本,并将输出放在文件中。
当我试图通过机器人发送嵌入时,我得到以下信息:
(node:612) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
at Function.normalizeFields (/HOMENAS/KitBot/node_modules/discord.js/src/s
在编写discord.js机器人代码时,我遇到了这个错误。
TypeError: message.guild.createRole is not a function
at Object.module.exports.run (/app/commands/myakish.js:7:36)
at Client.bot.on (/app/bot.js:70:7)
at Client.emit (events.js:189:13)
at MessageCreateAction.handle (/rbd/pnpm-volume/9ebd7b80-3cef-449a-8d