Skip to content

Commit cc318d3

Browse files
committed
discord
1 parent 6049ff3 commit cc318d3

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

packages/client-discord/src/messages.ts

+2-29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { composeContext } from "@elizaos/core";
1+
import { composeContext, composeRandomUser } from "@elizaos/core";
22
import { generateMessageResponse, generateShouldRespond } from "@elizaos/core";
33
import {
44
Content,
@@ -507,8 +507,6 @@ export class MessageManager {
507507
}
508508
}
509509

510-
<<<<<<< HEAD
511-
<<<<<<< HEAD
512510
private _isMessageForMe(message: DiscordMessage): boolean {
513511
const isMentioned = message.mentions.users?.has(
514512
this.client.user?.id as string
@@ -550,31 +548,6 @@ export class MessageManager {
550548
);
551549
}
552550

553-
=======
554-
>>>>>>> b04fe69e (gitbook data fetch.)
555-
=======
556-
private _isMessageForMe(message: DiscordMessage): boolean {
557-
const isMentioned = message.mentions.users?.has(this.client.user?.id as string);
558-
const guild = message.guild;
559-
const member = guild?.members.cache.get(this.client.user?.id as string);
560-
const nickname = member?.nickname;
561-
const memberId = member?.id;
562-
563-
// Don't consider role mentions as direct mentions
564-
const hasRoleMentionOnly = message.mentions.roles.size > 0 && !isMentioned;
565-
566-
// If it's only a role mention and we're in team mode, let team logic handle it
567-
if (hasRoleMentionOnly && this.runtime.character.clientConfig?.discord?.isPartOfTeam) {
568-
return false;
569-
}
570-
571-
return isMentioned || (!this.runtime.character.clientConfig?.discord?.shouldRespondOnlyToMentions && (
572-
message.content.toLowerCase().includes(this.client.user?.username.toLowerCase() as string) ||
573-
message.content.toLowerCase().includes(this.client.user?.tag.toLowerCase() as string) ||
574-
(nickname && message.content.toLowerCase().includes(nickname.toLowerCase()))));
575-
}
576-
577-
>>>>>>> 4ec26576 (fix mismatch.)
578551
async processMessageMedia(
579552
message: DiscordMessage
580553
): Promise<{ processedContent: string; attachments: Media[] }> {
@@ -1255,7 +1228,7 @@ export class MessageManager {
12551228
this.runtime.character.templates
12561229
?.discordShouldRespondTemplate ||
12571230
this.runtime.character.templates?.shouldRespondTemplate ||
1258-
discordShouldRespondTemplate,
1231+
composeRandomUser(discordShouldRespondTemplate, 2),
12591232
});
12601233

12611234
const response = await generateShouldRespond({

0 commit comments

Comments
 (0)