Skip to content

Commit

Permalink
discord
Browse files Browse the repository at this point in the history
  • Loading branch information
humanagent committed Dec 28, 2024
1 parent 6049ff3 commit cc318d3
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions packages/client-discord/src/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { composeContext } from "@elizaos/core";
import { composeContext, composeRandomUser } from "@elizaos/core";
import { generateMessageResponse, generateShouldRespond } from "@elizaos/core";
import {
Content,
Expand Down Expand Up @@ -507,8 +507,6 @@ export class MessageManager {
}
}

<<<<<<< HEAD
<<<<<<< HEAD
private _isMessageForMe(message: DiscordMessage): boolean {
const isMentioned = message.mentions.users?.has(
this.client.user?.id as string
Expand Down Expand Up @@ -550,31 +548,6 @@ export class MessageManager {
);
}

=======
>>>>>>> b04fe69e (gitbook data fetch.)
=======
private _isMessageForMe(message: DiscordMessage): boolean {
const isMentioned = message.mentions.users?.has(this.client.user?.id as string);
const guild = message.guild;
const member = guild?.members.cache.get(this.client.user?.id as string);
const nickname = member?.nickname;
const memberId = member?.id;

// Don't consider role mentions as direct mentions
const hasRoleMentionOnly = message.mentions.roles.size > 0 && !isMentioned;

// If it's only a role mention and we're in team mode, let team logic handle it
if (hasRoleMentionOnly && this.runtime.character.clientConfig?.discord?.isPartOfTeam) {
return false;
}

return isMentioned || (!this.runtime.character.clientConfig?.discord?.shouldRespondOnlyToMentions && (
message.content.toLowerCase().includes(this.client.user?.username.toLowerCase() as string) ||
message.content.toLowerCase().includes(this.client.user?.tag.toLowerCase() as string) ||
(nickname && message.content.toLowerCase().includes(nickname.toLowerCase()))));
}

>>>>>>> 4ec26576 (fix mismatch.)
async processMessageMedia(
message: DiscordMessage
): Promise<{ processedContent: string; attachments: Media[] }> {
Expand Down Expand Up @@ -1255,7 +1228,7 @@ export class MessageManager {
this.runtime.character.templates
?.discordShouldRespondTemplate ||
this.runtime.character.templates?.shouldRespondTemplate ||
discordShouldRespondTemplate,
composeRandomUser(discordShouldRespondTemplate, 2),
});

const response = await generateShouldRespond({
Expand Down

0 comments on commit cc318d3

Please sign in to comment.