【发布时间】:2022-11-20 07:39:07
【问题描述】:
所以目前,我正在 Replit discord.js 中制作一个 discord 机器人。我想做经济系统,代码中间被“截断”了,好像写了“return”,但是没有。
else if (type === "cashadd") {
let target = message.mentions.users.first();
const amount = args.join(" ");
if (!target) return message.channel.send("Please metion someone!")
______________________ <- here the code is "cutted"
if (!amount) return message.channel.send("Please specify the amount of money you want to send!")
if(isNaN(amount)) return message.channel.send("please enter a real number")
let userBalance = await db.get(`wallet_${target}`)
await db.set(`wallet_${target}`, userBalance + amount)
message.channel.send(`You sent ${amount} money to ${target}`)
}
完整代码:https://pastebin.com/eaStV20P (如果有用的话,我正在使用从 Imagine gaming play 处理的命令)
我试着放一个额外的代码,说“它有效”,我在想它是否这样说。它没有。
【问题讨论】:
-
大概找不到
target,message.channel.send调用是否导致消息被发送到频道?
标签: node.js discord discord.js