Curso-lenguaje-python/catch-all/06_bots_telegram/01_id_bot/id_bot.py

17 lines
332 B
Python
Raw Permalink Normal View History

2024-07-10 01:03:15 +02:00
import telebot
import os
from dotenv import load_dotenv
load_dotenv('.env')
BOT_TOKEN = os.getenv('BOT_TOKEN')
bot = telebot.TeleBot(BOT_TOKEN)
@bot.message_handler(commands=['get_group_id'])
def get_group_id(message):
chat_id = message.chat.id
bot.reply_to(message, f"El ID de este grupo es: {chat_id}")
bot.polling()