Use channel id instead of name

This commit is contained in:
Pedro Rey Anca 2025-02-10 13:16:41 +01:00
parent cc7ead6059
commit a54471ca72
Signed by: peprolinbot
GPG key ID: 053EA6E00116533A
3 changed files with 3 additions and 3 deletions

View file

@ -15,7 +15,7 @@ This is the bot that actually scrapes the menus from Telegram and puts them in a
| `TG_API_ID` | YES | Your telegram API Id |
| `TG_API_HASH` | YES | Your telegram API Hash |
| `TG_SESSION_NAME` | NO | The telethon session name/path _(Default: "default")_ |
| `TG_CHANNEL_NAME` | NO | The channel where the menu info is stored _(Default: "CafeteriaFIC")_ |
| `TG_CHANNEL_ID` | NO | The channel where the menu info is stored _(Default: -1001385379004 (id of https://t.me/CafeteriaFIC))_ |
| `MENU_HISTORY_FILE_PATH` | NO | The place where the JSON file with the menu history will be stored. _(Default: "/tmp/menu_history.json")_ |
_**Tip💡:**_ Look at [Telethon documentation](https://docs.telethon.dev/en/stable/basic/signing-in.html#signing-in) for info about the telegram authentication process

View file

@ -6,7 +6,7 @@ from utils import parse_menu_message, InvalidMenuMessageError
client = TelegramClient(config.session_name, config.api_id, config.api_hash)
@client.on(events.NewMessage(chats=config.channel_name))
@client.on(events.NewMessage(chats=config.channel_id))
async def handler(event):
msg = event.message
if not msg.message is None:

View file

@ -3,7 +3,7 @@ from os import getenv
api_id = getenv("TG_API_ID")
api_hash = getenv("TG_API_HASH")
session_name = getenv("TG_SESSION_NAME", "default")
channel_name = getenv("TG_CHANNEL_NAME", "CafeteriaFIC")
channel_id = int(getenv("TG_CHANNEL_ID", -1001385379004))
menu_history_file_path = getenv(
"MENU_HISTORY_FILE_PATH", "/tmp/menu_history.json")