@elizaos/plugin-discord 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4047,7 +4047,7 @@ var voiceStateProvider = {
|
|
|
4047
4047
|
// src/service.ts
|
|
4048
4048
|
import {
|
|
4049
4049
|
ChannelType as ChannelType7,
|
|
4050
|
-
EventType
|
|
4050
|
+
EventType,
|
|
4051
4051
|
Role,
|
|
4052
4052
|
Service,
|
|
4053
4053
|
createUniqueUuid as createUniqueUuid5,
|
|
@@ -4140,7 +4140,6 @@ function getDiscordSettings(runtime) {
|
|
|
4140
4140
|
// src/messages.ts
|
|
4141
4141
|
import {
|
|
4142
4142
|
ChannelType as ChannelType5,
|
|
4143
|
-
EventType,
|
|
4144
4143
|
ServiceType as ServiceType4,
|
|
4145
4144
|
MemoryType,
|
|
4146
4145
|
createUniqueUuid as createUniqueUuid3,
|
|
@@ -4714,14 +4713,10 @@ var MessageManager = class {
|
|
|
4714
4713
|
if (this.discordSettings.shouldRespondOnlyToMentions) {
|
|
4715
4714
|
const shouldProcess = isDM || isBotMentioned || isReplyToBot;
|
|
4716
4715
|
if (!shouldProcess) {
|
|
4717
|
-
logger11.debug(
|
|
4718
|
-
"[Discord] Strict mode: ignoring message (no @mention or reply)"
|
|
4719
|
-
);
|
|
4716
|
+
logger11.debug("[Discord] Strict mode: ignoring message (no @mention or reply)");
|
|
4720
4717
|
return;
|
|
4721
4718
|
}
|
|
4722
|
-
logger11.debug(
|
|
4723
|
-
"[Discord] Strict mode: processing message (has @mention or reply)"
|
|
4724
|
-
);
|
|
4719
|
+
logger11.debug("[Discord] Strict mode: processing message (has @mention or reply)");
|
|
4725
4720
|
}
|
|
4726
4721
|
const entityId = createUniqueUuid3(this.runtime, message.author.id);
|
|
4727
4722
|
const userName = message.author.bot ? `${message.author.username}#${message.author.discriminator}` : message.author.username;
|
|
@@ -4756,7 +4751,10 @@ var MessageManager = class {
|
|
|
4756
4751
|
try {
|
|
4757
4752
|
const canSendResult = canSendMessage(message.channel);
|
|
4758
4753
|
if (!canSendResult.canSend) {
|
|
4759
|
-
return logger11.warn(
|
|
4754
|
+
return logger11.warn(
|
|
4755
|
+
`Cannot send message to channel ${message.channel}`,
|
|
4756
|
+
canSendResult.reason || void 0
|
|
4757
|
+
);
|
|
4760
4758
|
}
|
|
4761
4759
|
const { processedContent, attachments } = await this.processMessage(message);
|
|
4762
4760
|
const audioAttachments = message.attachments.filter(
|
|
@@ -4848,7 +4846,12 @@ var MessageManager = class {
|
|
|
4848
4846
|
await u.send(content.text || "");
|
|
4849
4847
|
messages = [content];
|
|
4850
4848
|
} else {
|
|
4851
|
-
messages = await sendMessageInChunks(
|
|
4849
|
+
messages = await sendMessageInChunks(
|
|
4850
|
+
channel,
|
|
4851
|
+
content.text ?? "",
|
|
4852
|
+
message.id,
|
|
4853
|
+
files || []
|
|
4854
|
+
);
|
|
4852
4855
|
}
|
|
4853
4856
|
const memories = [];
|
|
4854
4857
|
for (const m of messages) {
|
|
@@ -4886,11 +4889,7 @@ var MessageManager = class {
|
|
|
4886
4889
|
return [];
|
|
4887
4890
|
}
|
|
4888
4891
|
};
|
|
4889
|
-
this.runtime.
|
|
4890
|
-
runtime: this.runtime,
|
|
4891
|
-
message: newMessage,
|
|
4892
|
-
callback
|
|
4893
|
-
});
|
|
4892
|
+
await this.runtime.messageService.handleMessage(this.runtime, newMessage, callback);
|
|
4894
4893
|
setTimeout(() => {
|
|
4895
4894
|
if (typingData.started && typingData.interval && !typingData.cleared) {
|
|
4896
4895
|
clearInterval(typingData.interval);
|
|
@@ -4920,7 +4919,7 @@ var MessageManager = class {
|
|
|
4920
4919
|
processedContent += " Description:" + (embed.description ?? "(none)") + "\n";
|
|
4921
4920
|
}
|
|
4922
4921
|
}
|
|
4923
|
-
if (message.reference) {
|
|
4922
|
+
if (message.reference && message.reference.messageId) {
|
|
4924
4923
|
const messageId = createUniqueUuid3(this.runtime, message.reference.messageId);
|
|
4925
4924
|
processedContent += "\nReferencing MessageID " + messageId + " (discord: " + message.reference.messageId + ")";
|
|
4926
4925
|
if (message.reference.channelId !== message.channel.id) {
|
|
@@ -5056,7 +5055,10 @@ function createOpusDecoder(options) {
|
|
|
5056
5055
|
const report = generateDependencyReport();
|
|
5057
5056
|
logger12.debug("Voice dependency report:", report);
|
|
5058
5057
|
} catch (reportError) {
|
|
5059
|
-
logger12.warn(
|
|
5058
|
+
logger12.warn(
|
|
5059
|
+
"Could not generate dependency report:",
|
|
5060
|
+
reportError instanceof Error ? reportError.message : String(reportError)
|
|
5061
|
+
);
|
|
5060
5062
|
}
|
|
5061
5063
|
throw error;
|
|
5062
5064
|
}
|
|
@@ -5320,7 +5322,10 @@ var VoiceManager = class extends EventEmitter {
|
|
|
5320
5322
|
}
|
|
5321
5323
|
});
|
|
5322
5324
|
connection.on("error", (error) => {
|
|
5323
|
-
logger12.log(
|
|
5325
|
+
logger12.log(
|
|
5326
|
+
"Voice connection error:",
|
|
5327
|
+
error instanceof Error ? error.message : String(error)
|
|
5328
|
+
);
|
|
5324
5329
|
logger12.log("Connection error - will attempt to recover...");
|
|
5325
5330
|
});
|
|
5326
5331
|
this.connections.set(channel.id, connection);
|
|
@@ -5330,7 +5335,10 @@ var VoiceManager = class extends EventEmitter {
|
|
|
5330
5335
|
await me.voice.setDeaf(false);
|
|
5331
5336
|
await me.voice.setMute(false);
|
|
5332
5337
|
} catch (error) {
|
|
5333
|
-
logger12.log(
|
|
5338
|
+
logger12.log(
|
|
5339
|
+
"Failed to modify voice state:",
|
|
5340
|
+
error instanceof Error ? error.message : String(error)
|
|
5341
|
+
);
|
|
5334
5342
|
}
|
|
5335
5343
|
}
|
|
5336
5344
|
connection.receiver.speaking.on("start", async (entityId) => {
|
|
@@ -5354,7 +5362,10 @@ var VoiceManager = class extends EventEmitter {
|
|
|
5354
5362
|
}
|
|
5355
5363
|
});
|
|
5356
5364
|
} catch (error) {
|
|
5357
|
-
logger12.log(
|
|
5365
|
+
logger12.log(
|
|
5366
|
+
"Failed to establish voice connection:",
|
|
5367
|
+
error instanceof Error ? error.message : String(error)
|
|
5368
|
+
);
|
|
5358
5369
|
connection.destroy();
|
|
5359
5370
|
this.connections.delete(channel.id);
|
|
5360
5371
|
throw error;
|
|
@@ -5696,11 +5707,7 @@ var VoiceManager = class extends EventEmitter {
|
|
|
5696
5707
|
return [];
|
|
5697
5708
|
}
|
|
5698
5709
|
};
|
|
5699
|
-
this.runtime.
|
|
5700
|
-
runtime: this.runtime,
|
|
5701
|
-
message: memory,
|
|
5702
|
-
callback
|
|
5703
|
-
});
|
|
5710
|
+
await this.runtime.messageService.handleMessage(this.runtime, memory, callback);
|
|
5704
5711
|
} catch (error) {
|
|
5705
5712
|
console.error("Error processing voice message:", error);
|
|
5706
5713
|
}
|
|
@@ -6235,7 +6242,7 @@ var DiscordService = class _DiscordService extends Service {
|
|
|
6235
6242
|
const tag = member.user.bot ? `${member.user.username}#${member.user.discriminator}` : member.user.username;
|
|
6236
6243
|
const worldId = createUniqueUuid5(this.runtime, guild.id);
|
|
6237
6244
|
const entityId = createUniqueUuid5(this.runtime, member.id);
|
|
6238
|
-
this.runtime.emitEvent([
|
|
6245
|
+
this.runtime.emitEvent([EventType.ENTITY_JOINED], {
|
|
6239
6246
|
runtime: this.runtime,
|
|
6240
6247
|
entityId,
|
|
6241
6248
|
worldId,
|
|
@@ -6290,7 +6297,7 @@ var DiscordService = class _DiscordService extends Service {
|
|
|
6290
6297
|
server: fullGuild,
|
|
6291
6298
|
source: "discord"
|
|
6292
6299
|
});
|
|
6293
|
-
this.runtime.emitEvent([
|
|
6300
|
+
this.runtime.emitEvent([EventType.WORLD_JOINED], standardizedData);
|
|
6294
6301
|
}
|
|
6295
6302
|
/**
|
|
6296
6303
|
* Handles interactions created by the user, specifically commands and message components.
|
|
@@ -6666,7 +6673,7 @@ var DiscordService = class _DiscordService extends Service {
|
|
|
6666
6673
|
},
|
|
6667
6674
|
source: "discord"
|
|
6668
6675
|
};
|
|
6669
|
-
this.runtime.emitEvent([
|
|
6676
|
+
this.runtime.emitEvent([EventType.WORLD_CONNECTED], standardizedData);
|
|
6670
6677
|
} catch (error) {
|
|
6671
6678
|
this.runtime.logger.error(`Error during Discord world connection: ${error instanceof Error ? error.message : String(error)}`);
|
|
6672
6679
|
}
|