refactor(channels): share reset-command normalization utility
This commit is contained in:
@@ -17,7 +17,7 @@ import type {
|
||||
ChannelAdapter,
|
||||
ChannelStatus,
|
||||
} from '../types.js';
|
||||
import { splitMessage } from '../utils.js';
|
||||
import { normalizeResetCommandText, splitMessage } from '../utils.js';
|
||||
import type { PairingManager } from '../pairing.js';
|
||||
|
||||
/** Configuration for the Discord channel adapter. */
|
||||
@@ -221,7 +221,8 @@ export class DiscordAdapter implements ChannelAdapter {
|
||||
} catch { /* ignore typing errors */ }
|
||||
|
||||
// Strip bot mention from the message text
|
||||
const text = message.content.replace(/<@!?\d+>/g, '').trim();
|
||||
const rawText = message.content.replace(/<@!?\d+>/g, '').trim();
|
||||
const text = normalizeResetCommandText(rawText);
|
||||
|
||||
// ── Extract media attachments ──
|
||||
const attachments: Attachment[] = [];
|
||||
@@ -240,7 +241,7 @@ export class DiscordAdapter implements ChannelAdapter {
|
||||
}
|
||||
|
||||
// ── Reset command ──
|
||||
if (text === '!reset' || text === 'reset') {
|
||||
if (text === '!reset') {
|
||||
this.messageHandler({
|
||||
id: message.id,
|
||||
channel: 'discord',
|
||||
|
||||
Reference in New Issue
Block a user