Telegram Bot
[1]:
%load_ext autoreload
%autoreload 2
from TelegramBotNotifications import TelegramBot
import decouple
[2]:
t=TelegramBot(
    #this is the API token, string
    decouple.config("TELEGRAM_TOKEN"),
    channel_mode=True,
    users_path="../../../telegram_users.csv")
### TELEGRAM BOT
# Checking new users
No new users.
[3]:
t.updates
[3]:
| username | date | chat_id | message | |
|---|---|---|---|---|
| 0 | None | 2022-03-30 17:19:52+00:00 | 5055308345 | F72LEZ5UEC | 
| 1 | None | 2022-03-30 17:19:53+00:00 | 5055308345 | C64KMDK6HB | 
| 2 | None | 2022-03-30 17:19:55+00:00 | 5055308345 | RMOAQOA2GE | 
| 3 | None | 2022-03-30 17:22:36+00:00 | 5055308345 | XA8JEZUAJK | 
| 4 | None | 2022-03-30 17:22:39+00:00 | 5055308345 | KR4PK9NYEB | 
[4]:
t.users
[4]:
| chat_id | username | date_joined | |
|---|---|---|---|
| 0 | 5055308345 | admin | 2022-02-06 21:55:54+00:00 | 
[5]:
t.send_message_to_user("ciao","admin")
[6]:
t.send_message_to_user("ciao","addmin")
UserNotFoundError
[7]:
t.send_photo("../temp/ADA_20220201-214758.jpeg",888418315)
SendPhotoError
[8]:
t.error_log
[8]:
[{'error': 'UserNotFoundError', 'e': KeyError('addmin')},
 {'error': 'SendPhotoError',
  'e': FileNotFoundError(2, 'No such file or directory')}]