【发布时间】:2021-05-15 13:21:26
【问题描述】:
所以下面是我的 javascript 代码。它包含在 module.exports 中,但这不是错误。
parseMention = (arg, asId = false) => {
if(!arg.startsWith('<@') && arg.endsWith('>')) return undefined
let id = arg.slice(2, -1)
if(id.startsWith('!')) id.slice(1)
if(asId === true) return id
if(asId === false) return bot.users.cache.get(id)
}
尽管对我来说似乎是正确的,但我收到以下错误消息:
SyntaxError: 无效的速记属性初始化器
任何帮助将不胜感激
【问题讨论】:
-
请在您调用此方法的位置添加代码部分...
-
你在这里做什么,//if(id.startsWith('!')) id.slice(1)// id.slice(1) 返回另一个你没有分配的数组将数组返回到任何位置。
标签: javascript discord discord.js