按钮禁止命令
Button Ban Command
目前我正在尝试制作一个禁止命令,其中包含用于确定是否应禁止用户的按钮。但是,它现在将作者和用户设置为 'undefined',即使已经提供了用户。
(旁注,控制台中没有显示错误)
由于代码比较大,我决定做一个 hastebin。 Link: https://www.toptal.com/developers/hastebin/enolimecir.js
我查看了您的代码,正如您在第 26 - 31 行 (.setDescription) 中看到的那样,这就是未定义的来源。
.setDescription(`**User:** ${user.user.mention}\n**Moderator:** ${message.author.mention}\n**Reason:** ${reason}`)
user.user.mention
根本不起作用,因为您已经定义了用户,但是您在第二个用户".user"
处再次定义了一个用户。提及,而不是像这样:
**User:** <@${user.id}>
第二个 undefined 是请求封禁的版主 message.author.mention
message.author
是正确的,但 .mention
不是,所以你要做什么而是:
**Moderator:** <@${message.author.id}>
目前我正在尝试制作一个禁止命令,其中包含用于确定是否应禁止用户的按钮。但是,它现在将作者和用户设置为 'undefined',即使已经提供了用户。
(旁注,控制台中没有显示错误)
由于代码比较大,我决定做一个 hastebin。 Link: https://www.toptal.com/developers/hastebin/enolimecir.js
我查看了您的代码,正如您在第 26 - 31 行 (.setDescription) 中看到的那样,这就是未定义的来源。
.setDescription(`**User:** ${user.user.mention}\n**Moderator:** ${message.author.mention}\n**Reason:** ${reason}`)
user.user.mention
根本不起作用,因为您已经定义了用户,但是您在第二个用户".user"
处再次定义了一个用户。提及,而不是像这样:
**User:** <@${user.id}>
第二个 undefined 是请求封禁的版主 message.author.mention
message.author
是正确的,但 .mention
不是,所以你要做什么而是:
**Moderator:** <@${message.author.id}>