Audit outbound delivery and fix reviewer turn routing
This commit is contained in:
@@ -601,6 +601,8 @@ export class DiscordChannel implements Channel {
|
||||
attachmentCount: files.length,
|
||||
messageId: sentMessageIds[0] ?? null,
|
||||
messageIds: sentMessageIds,
|
||||
botUserId: this.client.user?.id ?? null,
|
||||
botUsername: this.client.user?.username ?? null,
|
||||
},
|
||||
'Discord message sent',
|
||||
);
|
||||
@@ -689,6 +691,18 @@ export class DiscordChannel implements Channel {
|
||||
const channel = await this.client.channels.fetch(channelId);
|
||||
if (!channel || !('send' in channel)) return null;
|
||||
const msg = await (channel as TextChannel).send(text);
|
||||
logger.info(
|
||||
{
|
||||
jid,
|
||||
channelName: this.name,
|
||||
deliveryMode: 'tracked-send',
|
||||
messageId: msg.id,
|
||||
botUserId: this.client.user?.id ?? null,
|
||||
botUsername: this.client.user?.username ?? null,
|
||||
length: text.length,
|
||||
},
|
||||
'Discord tracked message sent',
|
||||
);
|
||||
return msg.id;
|
||||
} catch (err) {
|
||||
logger.error({ jid, err }, 'Failed to send tracked Discord message');
|
||||
@@ -696,6 +710,14 @@ export class DiscordChannel implements Channel {
|
||||
}
|
||||
}
|
||||
|
||||
getOutboundAuditMeta() {
|
||||
return {
|
||||
channelName: this.name,
|
||||
botUserId: this.client?.user?.id ?? null,
|
||||
botUsername: this.client?.user?.username ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
async getChannelMeta(jids: string[]): Promise<Map<string, ChannelMeta>> {
|
||||
const result = new Map<string, ChannelMeta>();
|
||||
if (!this.client) return result;
|
||||
@@ -813,12 +835,21 @@ export class DiscordChannel implements Channel {
|
||||
deliveryMode: 'edit',
|
||||
messageId,
|
||||
length: text.length,
|
||||
botUserId: this.client.user?.id ?? null,
|
||||
botUsername: this.client.user?.username ?? null,
|
||||
},
|
||||
'Discord message edited',
|
||||
);
|
||||
} catch (err) {
|
||||
logger.debug(
|
||||
{ jid, channelName: this.name, messageId, err },
|
||||
{
|
||||
jid,
|
||||
channelName: this.name,
|
||||
messageId,
|
||||
botUserId: this.client?.user?.id ?? null,
|
||||
botUsername: this.client?.user?.username ?? null,
|
||||
err,
|
||||
},
|
||||
'Failed to edit Discord message',
|
||||
);
|
||||
throw err; // Re-throw so callers (e.g. dashboard) can reset message ID
|
||||
|
||||
Reference in New Issue
Block a user