I'm using this code snippet from the Jinx Selfbot from Github which I slightly modified to this template from the Discord Auto Reply index.js
bot.on('message', async(msg)=>{
let cmd = msg.content.split(" ")[0]
cmd = cmd.slice(settings.prefix.length);
let args = msg.content.split(" ").slice(1);
if(msg.content.startsWith(${PREFIX}) && msg.author.id === settings.ID){
console.log(cyan(`[COMMAND RAN] :: ${message}`));
and it keeps outputting this into command prompt when run with node.js
if(msg.content.startsWith(${PREFIX}) && msg.author.id === settings.ID){
^
SyntaxError: missing ) after argument list
[90m at wrapSafe (internal/modules/cjs/loader.js:1152:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1200:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:1085:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:950:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
Edit: I forgot to put in the original code snippet from the Jinx Selfbot
bot.on('message', async(msg)=>{
if(msg.author.id !== settings.ID) {
return;
}
let cmd = msg.content.split(" ")[0]
cmd = cmd.slice(settings.prefix.length);
let args = msg.content.split(" ").slice(1);
if(msg.content.startsWith(settings.prefix) && msg.author.id === settings.ID){
console.log(cyan(`[COMMAND RAN] :: ${msg.content}`));
As @Taplar said - ${}
is reserved to template literals . If you want to access a variable outside of them, use its' name without any additional symbols.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.