This commit is contained in:
2025-06-15 01:26:01 +09:00
parent 43a35e81bd
commit 5ee39bc38b

View File

@@ -100,9 +100,10 @@ class ControllerPlugin extends BaseControllerPlugin {
async sendMessage(request, nrc_msg) { async sendMessage(request, nrc_msg) {
const channel_id = this.controller.config.get('ClusterChatSync.discord_channel_mapping')[request.instanceName]; const channel_id = this.controller.config.get('ClusterChatSync.discord_channel_mapping')[request.instanceName];
if (!channel_id) return; if (!channel_id) return;
let channel;
try { try {
let channel = await this.client.channels.fetch(channel_id); channel = await this.client.channels.fetch(channel_id);
if (channel === null) { if (channel === null) {
this.logger.error(`[Chat Sync] Discord Channel ID ${channel_id} not found.`); this.logger.error(`[Chat Sync] Discord Channel ID ${channel_id} not found.`);
@@ -125,9 +126,7 @@ class ControllerPlugin extends BaseControllerPlugin {
if (nrc_lindex !== -1) { if (nrc_lindex !== -1) {
nrc_cmsg = nrc_cmsg.slice(0, nrc_lindex); nrc_cmsg = nrc_cmsg.slice(0, nrc_lindex);
nrc_msg = nrc_msg.slice(nrc_lindex).trim(); nrc_msg = nrc_msg.slice(nrc_lindex).trim();
} else { } else {nrc_msg = nrc_msg.slice(MAX_DISCORD_MESSAGE_LENGTH).trim();}
nrc_msg = nrc_msg.slice(MAX_DISCORD_MESSAGE_LENGTH).trim();
}
await channel.send(nrc_cmsg, {allowedMentions: {parse: []}}); await channel.send(nrc_cmsg, {allowedMentions: {parse: []}});
} }