This is going to sound really stupid, but is prefix actually defined? You may have defined it in anothet function, but I don’t think it’s global, because the lines with errors both have prefix in them - can you try replacing them with your prefix e.g. '!':
bot.on("message", (message) => {
if (message.author.bot) return;
if (message.channel.type === "dm") return;.
if(message.content == `<@${bot.user.id}>` || message.content == `<@!${bot.user.id}>`) return message.reply("Hey My Prefix Is !")
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
if (!message.content.startsWith("!")) return;
let commandfile = bot.commands.get(cmd.slice("!".length));
if (commandfile) commandfile.run(bot, message, args);
});
Hey, can you please wrap your code in a code block? It makes it a bit easier to diagnose your code because Discourse does not render markdown in code block.