refactor(channels): share reset-command normalization utility
This commit is contained in:
@@ -15,7 +15,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 Slack channel adapter. */
|
||||
@@ -344,7 +344,8 @@ export class SlackAdapter implements ChannelAdapter {
|
||||
const peerId = `${channelId}:${threadTs}`;
|
||||
|
||||
// Strip bot mentions: <@U\w+> pattern
|
||||
let text = (message.text ?? '').replace(/<@U\w+>/g, '').trim();
|
||||
const rawText = (message.text ?? '').replace(/<@U\w+>/g, '').trim();
|
||||
const text = normalizeResetCommandText(rawText);
|
||||
|
||||
// Resolve display name from Slack user ID
|
||||
const senderName = message.user
|
||||
@@ -355,7 +356,7 @@ export class SlackAdapter implements ChannelAdapter {
|
||||
const attachments = await this.extractMediaAttachments(message.files);
|
||||
|
||||
// Detect reset command
|
||||
if (text === '!reset' || text === 'reset') {
|
||||
if (text === '!reset') {
|
||||
this.messageHandler({
|
||||
id: message.ts ?? '',
|
||||
channel: 'slack',
|
||||
|
||||
Reference in New Issue
Block a user