Skip to content

allow mention commands - #216

Merged
jeremy-rifkin merged 3 commits into
TCCPP:mainfrom
ngtv2409:mention-command
Oct 25, 2026
Merged

jeremy-rifkin merged 3 commits into
TCCPP:mainfrom
ngtv2409:mention-command

Conversation

@ngtv2409

@ngtv2409 ngtv2409 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Allow messages with content beginning with a mention to wheatley to be recognized as a command. #182

@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

@jeremy-rifkin jeremy-rifkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Comment thread src/command-handler.ts Outdated
// returns false if the message was not a wheatley command
private async handle_text_command(message: Discord.Message, prev_command_obj?: TextBasedCommand) {
const match = message.content.match(CommandHandler.command_regex);
const cmd = message.content.replace(new RegExp(String.raw`^\s*<@${this.wheatley.client.user?.id}>\s*`), "");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const cmd = message.content.replace(new RegExp(String.raw`^\s*<@${this.wheatley.client.user?.id}>\s*`), "");
const command_text = message.content.replace(new RegExp(`^\s*<@!?${id}>\s*`), "");

Comment thread src/command-handler.ts Outdated
return;
}
if (message.content.startsWith("!")) {
const cmd = message.content.replace(new RegExp(String.raw`^\s*<@${this.wheatley.client.user?.id}>\s*`), "");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be best to pull out the repeated regex

@sonarqubecloud

Copy link
Copy Markdown

@jeremy-rifkin jeremy-rifkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! I think we should be good to move (I'll apply one suggestion above)

Comment thread src/command-handler.ts Outdated
@jeremy-rifkin
jeremy-rifkin merged commit 51a14ca into TCCPP:main Oct 25, 2026
4 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants