DryZex
1
I new in v12
And why this command not work me on v12?
bot.on(“message”, async message => {
if(message.author.bot) return;
if(message.channel.type === “dm”) return;
if (message == <@${bot.user.id}>
|| message == <@!${bot.user.id}>
) {
message.channel.cache.send(“Hey My Prefix Is !”)
}
let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", “utf8”));
if(!prefixes[message.guild.id]){
prefixes[message.guild.id] = {
prefixes: botconfig.prefix
};
}
let prefix = prefixes[message.guild.id].prefixes;
if(!message.content.startsWith(prefix)) return;
if(cooldown.has(message.author.id)){
message.delete();
return message.reply(“You have to wait 5 seconds between commands.”)
}
if(!message.member.hasPermission(“ADMINISTRATOR”)){
cooldown.add(message.author.id);
}
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
let commandfile = bot.commands.get(cmd.slice(prefix.length));
if(commandfile) commandfile.run(bot,message,args);
setTimeout(() => {
cooldown.delete(message.author.id)
}, cdseconds * 1000)
});
Hello, are you getting any errors?
formatted version:
bot.on(“message”, (message) => {
if (message.author.bot) return;
if (message.channel.type === “dm”) return;
if (message == < @$ {
bot.user.id
} > || message == < @!$ {
bot.user.id
} > ) {
message.channel.send(“Hey My Prefix Is!”)
}
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if (!message.content.startsWith(prefix)) return;
let commandfile = bot.commands.get(cmd.slice(prefix.length));
if (commandfile) commandfile.run(bot, message, args);
});
DryZex
5
I try your code and I have error
I’m just formatting the code, so others can view it and build off it.
DryZex
9
I want to learn v12 now
All my bot my v12
And this last commands don’t works
I don’t see why this was flagged.
2 Likes
DryZex
11
I try to label my bots and command its not work
Can you show us some logs, maybe?
DryZex
13
I try to label my bot and command not work
Try using the regular " character
The one in phone keyboards use a different type which js doesn’t not recognize
DryZex
15
What do you mean I did not understand you in what you said
bot.on("message", (message) => {
if (message.author.bot) return;
if (message.channel.type === "dm") return;
if (message == < @$ {
bot.user.id
} > || message == < @!$ {
bot.user.id
} > ) {
message.channel.send("Hey My Prefix Is!")
}
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if (!message.content.startsWith(prefix)) return;
let commandfile = bot.commands.get(cmd.slice(prefix.length));
if (commandfile) commandfile.run(bot, message, args);
});
I took @code-alt’s formatted version and changed it to the main quotes.
1 Like
bot.on("message", (message) => {
if (message.author.bot) return;
if (message.channel.type === "dm") return;
if (message <= @$ {
bot.user.id
} > || message <= @!$ {
bot.user.id
} > ) {
message.channel.send("Hey My Prefix Is!")
}
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if (!message.content.startsWith(prefix)) return;
let commandfile = bot.commands.get(cmd.slice(prefix.length));
if (commandfile) commandfile.run(bot, message, args);
});
Try this
Can i ask what the @$ is for?
DryZex
21
@bot
And bot say my prefix is