import asyncio
from pathlib import Path
import configparser
import os
from telegram import Bot

CONFIG_NAME = "config.ini"
CONFIG_FOLDER = "config"
PROJECT_DIRECTORY = Path(os.getcwd())

# -------------------------------------------------- #
# READ CONFIG FILE

# Read main config file
config = configparser.ConfigParser()
config_path = Path(PROJECT_DIRECTORY) / "config" / CONFIG_NAME
config.read(config_path)
config_default = config["DEFAULT"]

# -------------------------------------------------- #

bot_token = config_default["Bot_Token"]

# async def get_chat_id():
#     bot = Bot(token=bot_token)
#     updates = await bot.get_updates()

#     for update in updates:
#         return update.message.chat_id  # This will print the chat ID of the message sender
    
async def get_chat_id(bot_token):
    bot = Bot(token=bot_token)
    updates = await bot.get_updates()

    for update in updates:
        print(update.message.chat_id)
        return str(update.message.chat_id)  # This will print the chat ID of the message sender

if __name__ == "__main__":
    asyncio.run(get_chat_id(bot_token))
