Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: discord client duplicate function removal #1125

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 1 addition & 42 deletions packages/client-discord/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,47 +687,6 @@ export class MessageManager {
);
}

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;

// 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()))))
);
}

private async _analyzeContextSimilarity(
currentMessage: string,
previousContext?: MessageContext,
Expand Down Expand Up @@ -1218,7 +1177,7 @@ export class MessageManager {
return false;
}
}

if (message.mentions.has(this.client.user?.id as string)) return true;

const guild = message.guild;
Expand Down
Loading