You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#DISCORD | only respond when @ | cooldown on reply in MS
DISCORD_DIRECT_ONLY=true #true
DISCORD_COOLDOWN=0 #default 1 min (only applies when not direct @)
to add for messages.ts discord
async handleMessage(message: DiscordMessage) {
if (
message.interaction ||
message.author.id ===
this.client.user?.id /* || message.author?.bot*/
)
return;
//only respond too direct @ or replys
const isDirectMention = message.mentions.has(this.client.user?.id);
const isReplyToBot = message.reference?.messageId && (
await message.channel.messages.fetch(message.reference.messageId)
).author.id === this.client.user?.id;
const isDirectInteraction = isDirectMention || isReplyToBot;
if (settings.DISCORD_DIRECT_ONLY && !isDirectInteraction) {
console.log("Direct-only mode: ignoring non-mention message");
return;
}
if (isReplyToBot) {
console.log("Reply to bot detected");
}
// Only apply cooldown check for non-direct mentions
if (!isDirectInteraction) {
const timeSinceLastResponse = Date.now() - this.lastResponseTime;
if (timeSinceLastResponse < this.COOLDOWN_MS) {
console.log(`Cooling down for non-direct messages. Time remaining: ${(this.COOLDOWN_MS - timeSinceLastResponse)/1000}s`);
return;
}
} else {
console.log("Direct mention detected - bypassing cooldown");
}
.....
await this.runtime.processActions(
memory,
responseMessages,
state,
callback
);
this.lastResponseTime = Date.now();
}
The text was updated successfully, but these errors were encountered:
Does something like this exist for X/twitter too? It would be cool to be able to set the agent's to be more "choose-y" and not just reply to everything that's specified all the time.
to add for for .env
to add for messages.ts discord
The text was updated successfully, but these errors were encountered: