Skip to content

Commit 365c03f

Browse files
update
1 parent 0574af8 commit 365c03f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

.env.example

+4-4
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ HELIUS_API_KEY=
206206

207207
# Telegram Configuration
208208
#TELEGRAM_BOT_TOKEN=
209-
TELEGRAM_API_ID= # API ID from https://my.telegram.org/apps
210-
TELEGRAM_API_HASH= # API Hash from https://my.telegram.org/apps
209+
TELEGRAM_API_ID= # API ID from my.telegram.org/apps
210+
TELEGRAM_API_HASH= # API Hash from my.telegram.org/apps
211211
TELEGRAM_PHONE_NUMBER= # Your phone number in international format (e.g., +1234567890)
212-
TELEGRAM_ALLOWED_GROUPS= # Comma-separated list of group names (e.g., CryptoTalk,AIDiscussion)
213-
TELEGRAM_SESSION= # Paste the session string here after first login
212+
TELEGRAM_ALLOWED_GROUPS= # (Optional) Comma-separated list of group usernames (e.g., CryptoTalk,AIDiscussion)
213+
TELEGRAM_SESSION= # Will be auto-generated after first login
214214

215215
# Together Configuration
216216
TOGETHER_API_KEY=

packages/client-telegram/src/telegramUserClient.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ export class TelegramUserClient {
228228
return false;
229229
}
230230

231-
// Check if the chat title matches any of the allowed group names
232-
const chatTitle = chat.title || '';
233-
const isAllowed = this.allowedGroups.has(chatTitle);
234-
elizaLogger.log(`Group check - Name: ${chatTitle}, Allowed: ${isAllowed}`);
231+
// Check if the chat username matches any of the allowed group usernames
232+
const chatUsername = chat.username || '';
233+
const isAllowed = this.allowedGroups.has(chatUsername);
234+
elizaLogger.log(`Group check - Username: ${chatUsername}, Allowed: ${isAllowed}`);
235235
elizaLogger.log(`Allowed groups:`, Array.from(this.allowedGroups));
236236
return isAllowed;
237237
} catch (error) {

telegram_usage_instruction.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ Copy the following variables to your `.env` file and fill in your credentials:
3030
TELEGRAM_API_ID= # API ID from my.telegram.org/apps
3131
TELEGRAM_API_HASH= # API Hash from my.telegram.org/apps
3232
TELEGRAM_PHONE_NUMBER= # Your phone number in international format
33-
TELEGRAM_ALLOWED_GROUPS= # (Optional) Comma-separated list of group names (e.g., CryptoTalk,AIDiscussion)
33+
TELEGRAM_ALLOWED_GROUPS= # (Optional) Comma-separated list of group usernames (e.g., CryptoTalk,AIDiscussion)
3434
TELEGRAM_SESSION= # Will be auto-generated after first login
3535
```
3636

3737
### 3. Configure Allowed Groups (Optional)
3838

3939
To restrict the bot to specific groups:
4040
1. Add your bot to the desired Telegram groups
41-
2. Set the `TELEGRAM_ALLOWED_GROUPS` variable with the group names:
41+
2. Set the `TELEGRAM_ALLOWED_GROUPS` variable with the group usernames:
4242
```bash
4343
TELEGRAM_ALLOWED_GROUPS=CryptoTalk,AIDiscussion,BlockchainHub
4444
```
4545
3. The bot will only respond in these specified groups
46-
4. Group names are case-sensitive and should match exactly as shown in Telegram
46+
4. Group usernames are case-sensitive and should match exactly as shown in the invite link (e.g., if the invite link is t.me/MyGroup, use "MyGroup")
4747
5. Leave empty to allow the bot to respond in all groups
4848

4949
### 4. Start Eliza with CryptoAI Sage
@@ -73,7 +73,7 @@ pnpm start --characters=characters/cryptoai_sage.character.json
7373
## Usage Tips
7474

7575
- The bot will only respond in groups listed in `TELEGRAM_ALLOWED_GROUPS`
76-
- Group names must match exactly as they appear in Telegram (case-sensitive)
76+
- Group usernames must match exactly as they appear in the invite link (e.g., if the invite link is t.me/MyGroup, use "MyGroup")
7777
- You can add or remove groups by updating the `TELEGRAM_ALLOWED_GROUPS` list
7878
- If no groups are specified, the bot will not respond to any messages
7979
- You can interact with the bot in both private chats and groups just make sure to mention them in .env

0 commit comments

Comments
 (0)