1.0.6 RC4

This commit is contained in:
phidias authored and GitHub committed 2026-10-13 02:11:58 +09:00
1 parent 6a51d36d14
commit 969a770663
1 file changed
+24 -1
+24 -1
View File
@@ -90,6 +90,15 @@ interface Bucket {
warned: boolean;
}
/** Config is keyed by instance name; sendTo wants the controller's numeric ID. */
const findInstanceId = (instanceName: string): number | null => {
for (const [id, instance] of controller.instances) {
if (instance.name === instanceName) return id;
}
return null;
};
export default async function(context: ControllerPluginContext) {
const {controller, logger, plugin} = context;
@@ -271,8 +280,22 @@ export default async function(context: ControllerPluginContext) {
const authorName = message.member?.displayName ?? message.author.username;
for (const instanceName of instanceNames) {
const instanceId = findInstanceId(instanceName);
if (instanceId === null) {
if (!warnedNoInstance.has(instanceName)) {
warnedNoInstance.add(instanceName);
logger.warn(
`[Chat Relay] Instance ${instanceName} is mapped for chat but does not exist;`
+ ' dropping Discord messages for it.',
);
}
continue;
}
try {
await controller.sendTo(instanceName, new ChatFromDiscordEvent(
await controller.sendTo({instanceId: instanceId}, new ChatFromDiscordEvent(
authorName,
message.channelId,
datetime,