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

feat: Updated characters types, Discord & Telegram enhancements #957

Conversation

azep-ninja
Copy link
Contributor

@azep-ninja azep-ninja commented Dec 10, 2024

Relates to:

Issue 399

Risks

Low: Additional settings to character.json types are low level changes, and should not break any core functionality. Additionally discord messages.ts and telegram file additions are specific to the new settings, so risk is low.

Background

What does this PR do?

Enhances the Discord and Telegram bot's message handling to support:

  1. Configurable mentions-only mode via shouldRespondOnlyToMentions setting
  2. Allows bot joins to restricted telegram groups via shouldOnlyJoinInAllowedGroups setting

What kind of change is this?

Features (non-breaking change which adds functionality)
Improvements (misc. changes to existing features)

Documentation changes needed?

My changes require a change to the project documentation.

Add documentation for new shouldRespondOnlyToMentions config option
Add documentation for new shouldOnlyJoinInAllowedGroups config option

Testing

Where should a reviewer start?

  1. Review changes in messages.ts (Discord) and telegramClient.ts (Telegram), particularly:
  • New configuration option handling

Detailed testing steps

  1. Test single agent mentions-only mode:
  • Set shouldRespondOnlyToMentions: true
  • Verify agent only responds to direct mentions
  • Verify no responses to non-mention messages
  1. Test group add limitation for Telegram:
  • Set shouldOnlyJoinInAllowedGroups: true
  • Add TG bot to any chat with an empty array for approvedGroups and observer agent leave
  • Add TG bot to any chat with an array for approvedGroups and observer agent stay in chat

ninja_dev - Discord Username

@monilpat monilpat changed the title Updated characters types, Discord enhancements, and team features feat: Updated characters types, Discord enhancements, and team features Dec 11, 2024
monilpat
monilpat previously approved these changes Dec 11, 2024
Copy link
Collaborator

@monilpat monilpat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM outside of minor comments

@@ -69,6 +71,102 @@ export class MessageManager {
return;
}

const isDirectlyMentioned = this._isMessageForMe(message);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a check if discord settings is even configured before doing discord settings logic

}

private _isTeamCoordinationRequest(content: string): boolean {
const coordinationKeywords = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move this to a constant's file

@@ -32,6 +32,7 @@ import { sendMessageInChunks, canSendMessage } from "./utils.ts";

export type InterestChannels = {
[key: string]: {
currentHandler: any;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this me typed

@azep-ninja azep-ninja changed the title feat: Updated characters types, Discord enhancements, and team features feat: Updated characters types, Discord enhancements, Telegram fixes, and team feature additions Dec 12, 2024
@azep-ninja azep-ninja changed the base branch from main to develop December 12, 2024 18:27
@azep-ninja azep-ninja requested a review from monilpat December 12, 2024 21:19
@azep-ninja
Copy link
Contributor Author

Updated, fixed items, and added security feature for Telegram to limit bot add to groups, which if not wanted could get excessive usage of bot, leading to increased costs.

@lalalune
Copy link
Member

@azep-ninja this is great stuff, but would it be possible / not too painful to break up some of the more opinionated changes from the more general stuff? Like the telegram group and team stuff should probably be separate PRs for evaluation.

@odilitime odilitime deleted the branch elizaOS:develop December 13, 2024 02:37
@odilitime odilitime closed this Dec 13, 2024
@odilitime odilitime reopened this Dec 13, 2024
@azep-ninja
Copy link
Contributor Author

azep-ninja commented Dec 13, 2024

@azep-ninja this is great stuff, but would it be possible / not too painful to break up some of the more opinionated changes from the more general stuff? Like the telegram group and team stuff should probably be separate PRs for evaluation.

@lalalune yeah I can do that!

This PR is now updated for the more generic items and separate PRs have been created below for team specific settings per client.

PR 1032 - Discord Team Features

PR 1033 - Telegram Team Features

@azep-ninja azep-ninja changed the title feat: Updated characters types, Discord enhancements, Telegram fixes, and team feature additions feat: Updated characters types, Discord & Telegram enhancements Dec 13, 2024
@odilitime odilitime deleted the branch elizaOS:develop December 13, 2024 19:07
@odilitime odilitime closed this Dec 13, 2024
@odilitime odilitime reopened this Dec 13, 2024
@azep-ninja
Copy link
Contributor Author

All issues resolved here as well @odilitime .

@lalalune lalalune merged commit 9ac6f3b into elizaOS:develop Dec 15, 2024
3 of 4 checks passed
@azep-ninja azep-ninja deleted the discord-telegram-team-agents-and-optimizations branch December 15, 2024 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants