owengombas / discord.ts

🤖 Create your discord bot by using TypeScript and decorators!

Home Page:https://owencalvin.github.io/discord.ts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Option to mention bot

IcyTv opened this issue · comments

commented

Hi,
I would love to have a feature, where you can mention the bot (i,e, @ Bot help) and avoiding the prefix. I have tried to implement this using Guards or Rules and it simply does not work.
I know you can implement this in the on("Message") handler, but then you lose all modularity of the command/event structure, as you cannot forward or close.

commented

I figured it out. For everyone wondering:

const prefixBehavior = async (message: Message, client: Client) => {
	if(message.mentions.has(message.client.user.id)) {
		console.log(message.content.match(/<@.*>/)[0]);
		return message.content.match(/<@.*>/)[0] + " ";
	}
	return prefix;
}

@Discord(prefixBehavior, {