@elizaos/plugin-telegram 1.0.0-beta.4 → 1.0.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +56 -0
- package/dist/index.js +621 -255
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Shaw Walters
|
|
3
|
+
Copyright (c) 2025 Shaw Walters and elizaOS Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -22,6 +22,25 @@ Here are the available configuration options for the `character.json` file:
|
|
|
22
22
|
| `messageTrackingLimit` | Integer | `100` | Sets the maximum number of messages to track in memory for each chat. |
|
|
23
23
|
| `templates` | Object | `{}` | Allows customization of response templates for different message scenarios. |
|
|
24
24
|
|
|
25
|
+
## Error 409: Conflict in Multiple Agents Environment
|
|
26
|
+
|
|
27
|
+
When you encounter this error in your logs:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
error: 409: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This indicates a fundamental architectural limitation with the Telegram Bot API. The Telegram API strictly enforces that only one active connection can exist per bot token at any given time. This is by design to ensure reliable message delivery and prevent message duplication or loss.
|
|
34
|
+
|
|
35
|
+
In ElizaOS multi-agent environments, this error commonly occurs when:
|
|
36
|
+
|
|
37
|
+
1. **Multiple Agents Using Same Token**: Two or more agents (such as "Eliza" and another character) each have the `@elizaos/plugin-telegram` plugin enabled in their configuration
|
|
38
|
+
2. **Simultaneous Initialization**: Each agent independently attempts to initialize its own Telegram service during startup
|
|
39
|
+
3. **Token Collision**: All agents use the same `TELEGRAM_BOT_TOKEN` from your environment configuration
|
|
40
|
+
4. **Connection Rejection**: When a second agent tries to establish a connection while another is already active, Telegram rejects it with a 409 error
|
|
41
|
+
|
|
42
|
+
This is not a bug in ElizaOS or the Telegram plugin, but rather a result of using a shared resource (the bot token) that can only accept one connection at a time.
|
|
43
|
+
|
|
25
44
|
## Example `<charactername>.character.json`
|
|
26
45
|
|
|
27
46
|
Below is an example configuration file with all options:
|
|
@@ -85,3 +104,40 @@ npm run dev
|
|
|
85
104
|
```bash
|
|
86
105
|
bun start --character="characters/your-character.json"
|
|
87
106
|
```
|
|
107
|
+
|
|
108
|
+
## Utilizing Telegram Buttons
|
|
109
|
+
|
|
110
|
+
To send a message with native Telegram buttons, include an array of buttons in the message content. The following action demonstrates how to initiate a login flow using a Telegram button.
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
export const initAuthHandshakeAction: Action = {
|
|
114
|
+
name: 'INIT_AUTH_HANDSHAKE',
|
|
115
|
+
description: 'Initiates the identity linking and authentication flow for new users.',
|
|
116
|
+
validate: async (_runtime, _message, _state) => {
|
|
117
|
+
return _message.content.source === 'telegram';
|
|
118
|
+
},
|
|
119
|
+
handler: async (runtime, message, _state, _options, callback): Promise<boolean> => {
|
|
120
|
+
try {
|
|
121
|
+
const user = await getUser(message.userId);
|
|
122
|
+
if (user) return false;
|
|
123
|
+
|
|
124
|
+
callback({
|
|
125
|
+
text: "Let's get you set up with a new account",
|
|
126
|
+
buttons: [
|
|
127
|
+
{
|
|
128
|
+
text: '🔑 Authenticate with Telegram',
|
|
129
|
+
url: `${FRONTEND_URL}/integrations/telegram`,
|
|
130
|
+
kind: 'login',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
}).catch((error) => {
|
|
134
|
+
console.error('Error sending callback:', error);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
return true;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
...
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
```
|