【发布时间】:2020-02-22 10:16:31
【问题描述】:
我正在尝试制作一些人们必须付费才能使用一组命令的东西。我把那部分记下来了,但我很确定我在使用 return 函数时遇到了问题。
下面的代码使它发送错误消息,然后立即发送命令输出!如果他们的用户 ID 不在数组中,我希望它只发送错误消息。如果他们的 ID 在数组中,则发送正常的命令用法(使用 return,对吗?)
^^ 这是不在黄金成员数组中的用户所看到的。我想要它,所以我添加的人的 ID 只会显示命令输出。不在该用户 ID 数组中的人将看到错误(哎呀)消息。
var Spark = require("sparkbots")
const Permission = Spark.permission("Golds")
Permission.setLevel(5)
module.exports = Permission;
Permission.code = (client, message) => {
let golds = ['190916650143318016']
if(!golds.includes(message.author.id)){
return message.reply("Whoops! That's a ⭐ GOLD ⭐ user only command. Purchase gold here: https://willm.xyz/dis/gold")
} else {
return false }
}```
【问题讨论】:
-
您还应该共享调用
Permission.code的函数。
标签: javascript node.js discord discord.js