TeLLMgramBot 3.10.3__tar.gz → 3.10.4__tar.gz

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.
Files changed (24) hide show
  1. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/PKG-INFO +3 -3
  2. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/README.md +2 -2
  3. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/TeLLMgramBot.py +69 -17
  4. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot.egg-info/PKG-INFO +3 -3
  5. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/setup.py +1 -1
  6. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/LICENSE +0 -0
  7. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/__init__.py +0 -0
  8. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/conversation.py +0 -0
  9. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/database.py +0 -0
  10. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/initialize.py +0 -0
  11. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/message_handlers.py +0 -0
  12. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/models.py +0 -0
  13. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/providers/__init__.py +0 -0
  14. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/providers/anthropic_provider.py +0 -0
  15. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/providers/base.py +0 -0
  16. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/providers/factory.py +0 -0
  17. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/providers/openai_provider.py +0 -0
  18. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/utils.py +0 -0
  19. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot/web_utils.py +0 -0
  20. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot.egg-info/SOURCES.txt +0 -0
  21. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot.egg-info/dependency_links.txt +0 -0
  22. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot.egg-info/requires.txt +0 -0
  23. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/TeLLMgramBot.egg-info/top_level.txt +0 -0
  24. {tellmgrambot-3.10.3 → tellmgrambot-3.10.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TeLLMgramBot
3
- Version: 3.10.3
3
+ Version: 3.10.4
4
4
  Summary: LLM-powered Telegram bot (OpenAI + Anthropic)
5
5
  Home-page: https://github.com/Digital-Heresy/TeLLMgramBot
6
6
  Author: Digital Heresy
@@ -124,7 +124,7 @@ os.environ['TELLMGRAMBOT_VIRUSTOTAL_API_KEY'] = my_vault.get('virustotal_key')
124
124
  - `/nick <name>` - Set your nickname (for bot use in group chats).
125
125
  - `/forget` - Clear your conversation history. In private chats, clears everything and resets all active sessions. In group chats, removes only your messages.
126
126
  - `/private` - Toggle private mode (private chats only). When ON, your messages are excluded from group context loading.
127
- - `/help` - Display all available commands and usage information (includes administrator-only commands).
127
+ - `/help` - Display available commands and usage information. In private chats, if you are a bot owner, also shows administrator-only commands (`/start`, `/stop`, `/wipe`).
128
128
 
129
129
  ### Group Chat Triggers
130
130
  The bot responds in groups when you:
@@ -144,7 +144,7 @@ When the bot is triggered in a group and about to respond (not deferring to anot
144
144
  1. Ensure API keys are set up and your Telegram bot is created via BotFather.
145
145
  2. Install TeLLMgramBot: `pip install TeLLMgramBot`
146
146
  3. Configure the bot via `config.yaml` (created on first run):
147
- - `bot_owner`: Your Telegram username (required, no `@`)
147
+ - `bot_owner`: Telegram username(s) with admin access (required, no `@`). Accepts a single string or a YAML list of usernames.
148
148
  - `chat_model`: LLM model for conversation (e.g. `gpt-4o-mini` or `claude-sonnet-4-6`)
149
149
  - `url_model`: LLM model for URL analysis (e.g. `gpt-4o` or `claude-haiku-4-5`)
150
150
  - `bot_nickname` / `bot_initials`: Names the bot responds to in groups
@@ -92,7 +92,7 @@ os.environ['TELLMGRAMBOT_VIRUSTOTAL_API_KEY'] = my_vault.get('virustotal_key')
92
92
  - `/nick <name>` - Set your nickname (for bot use in group chats).
93
93
  - `/forget` - Clear your conversation history. In private chats, clears everything and resets all active sessions. In group chats, removes only your messages.
94
94
  - `/private` - Toggle private mode (private chats only). When ON, your messages are excluded from group context loading.
95
- - `/help` - Display all available commands and usage information (includes administrator-only commands).
95
+ - `/help` - Display available commands and usage information. In private chats, if you are a bot owner, also shows administrator-only commands (`/start`, `/stop`, `/wipe`).
96
96
 
97
97
  ### Group Chat Triggers
98
98
  The bot responds in groups when you:
@@ -112,7 +112,7 @@ When the bot is triggered in a group and about to respond (not deferring to anot
112
112
  1. Ensure API keys are set up and your Telegram bot is created via BotFather.
113
113
  2. Install TeLLMgramBot: `pip install TeLLMgramBot`
114
114
  3. Configure the bot via `config.yaml` (created on first run):
115
- - `bot_owner`: Your Telegram username (required, no `@`)
115
+ - `bot_owner`: Telegram username(s) with admin access (required, no `@`). Accepts a single string or a YAML list of usernames.
116
116
  - `chat_model`: LLM model for conversation (e.g. `gpt-4o-mini` or `claude-sonnet-4-6`)
117
117
  - `url_model`: LLM model for URL analysis (e.g. `gpt-4o` or `claude-haiku-4-5`)
118
118
  - `bot_nickname` / `bot_initials`: Names the bot responds to in groups
@@ -91,23 +91,49 @@ class TelegramBot:
91
91
  raise
92
92
 
93
93
  async def tele_commands(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
94
- """Show all the commands available when the user sends `/help` to the bot."""
95
- await update.message.reply_text("TeLLMgramBot commands:\n"
94
+ """
95
+ Show available commands when the user sends `/help` to the bot.
96
+
97
+ Displays general commands (/nick, /forget, /private, /help) to all users.
98
+ Admin commands (/start, /stop, /wipe) are shown only to usernames in bot_owner list,
99
+ and only in private chats (not in groups).
100
+
101
+ Args:
102
+ update: Telegram Update object containing the /help message.
103
+ context: Telegram context for sending the reply.
104
+ """
105
+ uname = update.message.from_user.username
106
+ chat_type = update.message.chat.type
107
+ text = (
108
+ "TeLLMgramBot commands:\n"
96
109
  "/nick - Set your nickname (e.g. \"/nick B0b #2\").\n"
97
- "/forget - Clear all of your conversations.\n"
110
+ "/forget - Clear memories of all your conversations.\n"
98
111
  "/private - Toggle private mode (private chats only).\n"
99
- "/help - Display this usage information.\n\n"
100
- "Chat history will still show in your Telegram client.\n\n"
101
- "Administrator-only commands:\n"
102
- "/start - Go online to receive new responses (default).\n"
103
- "/stop - Go offline to prevent new responses.\n"
104
- "/wipe - Permanently delete all conversation data (irreversible).\n"
112
+ "/help - Display this usage information."
105
113
  )
114
+ if uname in self.telegram['owners'] and chat_type == 'private':
115
+ text += (
116
+ "\n\nAdmin commands:\n"
117
+ "/start - Go online to receive new responses (default).\n"
118
+ "/stop - Go offline to prevent new responses.\n"
119
+ "/wipe - Permanently delete all conversation data (irreversible)."
120
+ )
121
+ await update.message.reply_text(text)
106
122
 
107
123
  async def tele_start_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
108
- """A bot_owner-only command to go online and handle any new messages."""
124
+ """
125
+ Start the bot and resume handling new messages (admin-only).
126
+
127
+ Only usernames in self.telegram['owners'] can execute this command.
128
+ If the sender is an owner, sets self._online to True and confirms via reply.
129
+ Otherwise, denies access with "Sorry, I can't do that for you."
130
+
131
+ Args:
132
+ update: Telegram Update object containing the /start message.
133
+ context: Telegram context for sending the reply.
134
+ """
109
135
  uname = update.message.from_user.username
110
- if uname == self.telegram['owner']:
136
+ if uname in self.telegram['owners']:
111
137
  self._online = True
112
138
  greeting_text = f"Oh, hello {update.message.from_user.first_name}! Let me get to work!"
113
139
  await update.message.reply_text(greeting_text)
@@ -115,18 +141,41 @@ class TelegramBot:
115
141
  await update.message.reply_text("Sorry, I can't do that for you.")
116
142
 
117
143
  async def tele_stop_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
118
- """A bot_owner-only command to go offline and not handle any new messages."""
144
+ """
145
+ Stop the bot and pause handling new messages (admin-only).
146
+
147
+ Only usernames in self.telegram['owners'] can execute this command.
148
+ If the sender is an owner, sets self._online to False and confirms via reply.
149
+ Otherwise, denies access with "Sorry, I can't do that for you."
150
+
151
+ Args:
152
+ update: Telegram Update object containing the /stop message.
153
+ context: Telegram context for sending the reply.
154
+ """
119
155
  uname = update.message.from_user.username
120
- if uname == self.telegram['owner']:
156
+ if uname in self.telegram['owners']:
121
157
  self._online = False
122
158
  await update.message.reply_text("Sure thing boss, cutting out!")
123
159
  else:
124
160
  await update.message.reply_text("Sorry, I can't do that for you.")
125
161
 
126
162
  async def tele_wipe_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
127
- """A bot_owner-only command to permanently delete all messages, users, and chats from the database."""
163
+ """
164
+ Permanently delete all conversation data from the database (admin-only).
165
+
166
+ Only usernames in self.telegram['owners'] can execute this command.
167
+ If the sender is an owner, deletes all messages, users, and chats via wipe_all_data(),
168
+ clears in-memory conversations and token warnings, and confirms via reply.
169
+ Otherwise, denies access with "Sorry, I can't do that for you."
170
+
171
+ This action is irreversible - all conversation history is permanently lost.
172
+
173
+ Args:
174
+ update: Telegram Update object containing the /wipe message.
175
+ context: Telegram context for sending the reply.
176
+ """
128
177
  uname = update.message.from_user.username
129
- if uname != self.telegram['owner']:
178
+ if uname not in self.telegram['owners']:
130
179
  await update.message.reply_text("Sorry, I can't do that for you.")
131
180
  return
132
181
  await wipe_all_data()
@@ -759,7 +808,8 @@ class TelegramBot:
759
808
  Initialize the Telegram bot with LLM configuration and API keys.
760
809
 
761
810
  Args:
762
- bot_owner: Telegram username of the bot owner (required, no `@`).
811
+ bot_owner: Telegram username(s) with admin access (no `@`).
812
+ Accepts a single string or a list of strings; normalised to list[str] internally.
763
813
  bot_nickname: Nickname the bot responds to in group chats.
764
814
  bot_initials: Initials the bot responds to in group chats.
765
815
  chat_model: LLM model for conversation (e.g., 'gpt-5-mini', 'claude-sonnet-4-6').
@@ -771,6 +821,7 @@ class TelegramBot:
771
821
  key_status: ApiKeyStatus object indicating available features. If None, calls init_structure().
772
822
 
773
823
  Side Effects:
824
+ - Normalises bot_owner to list[str] and stores in self.telegram['owners'].
774
825
  - Fetches bot metadata (username, first_name, last_name, bot_id) from Telegram API via _tele_info().
775
826
  - Initializes command and message handlers for the Telegram application.
776
827
  - Sets self._online to True once initialization completes (ready for polling).
@@ -785,9 +836,10 @@ class TelegramBot:
785
836
  # Initialize some variables
786
837
  self.token_warning = {} # Determines whether user has reached token limit by AI model
787
838
  self.conversations = {} # Provides Conversation class per user based on bot response
839
+ owners = bot_owner if isinstance(bot_owner, list) else [bot_owner]
788
840
  self.telegram = {
789
841
  'bot_id' : 0, # overwritten by _tele_info(); 0 is a safe sentinel
790
- 'owner' : bot_owner,
842
+ 'owners' : [str(u).strip() for u in owners if str(u).strip()],
791
843
  'nickname' : bot_nickname,
792
844
  'initials' : bot_initials,
793
845
  'username' : None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TeLLMgramBot
3
- Version: 3.10.3
3
+ Version: 3.10.4
4
4
  Summary: LLM-powered Telegram bot (OpenAI + Anthropic)
5
5
  Home-page: https://github.com/Digital-Heresy/TeLLMgramBot
6
6
  Author: Digital Heresy
@@ -124,7 +124,7 @@ os.environ['TELLMGRAMBOT_VIRUSTOTAL_API_KEY'] = my_vault.get('virustotal_key')
124
124
  - `/nick <name>` - Set your nickname (for bot use in group chats).
125
125
  - `/forget` - Clear your conversation history. In private chats, clears everything and resets all active sessions. In group chats, removes only your messages.
126
126
  - `/private` - Toggle private mode (private chats only). When ON, your messages are excluded from group context loading.
127
- - `/help` - Display all available commands and usage information (includes administrator-only commands).
127
+ - `/help` - Display available commands and usage information. In private chats, if you are a bot owner, also shows administrator-only commands (`/start`, `/stop`, `/wipe`).
128
128
 
129
129
  ### Group Chat Triggers
130
130
  The bot responds in groups when you:
@@ -144,7 +144,7 @@ When the bot is triggered in a group and about to respond (not deferring to anot
144
144
  1. Ensure API keys are set up and your Telegram bot is created via BotFather.
145
145
  2. Install TeLLMgramBot: `pip install TeLLMgramBot`
146
146
  3. Configure the bot via `config.yaml` (created on first run):
147
- - `bot_owner`: Your Telegram username (required, no `@`)
147
+ - `bot_owner`: Telegram username(s) with admin access (required, no `@`). Accepts a single string or a YAML list of usernames.
148
148
  - `chat_model`: LLM model for conversation (e.g. `gpt-4o-mini` or `claude-sonnet-4-6`)
149
149
  - `url_model`: LLM model for URL analysis (e.g. `gpt-4o` or `claude-haiku-4-5`)
150
150
  - `bot_nickname` / `bot_initials`: Names the bot responds to in groups
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name='TeLLMgramBot',
8
- version='3.10.3',
8
+ version='3.10.4',
9
9
  packages=find_packages(),
10
10
  license='MIT',
11
11
  author='Digital Heresy',
File without changes
File without changes