You've already forked Curso-lenguaje-python
Update Bots Telegram
This commit is contained in:
16
catch-all/06_bots_telegram/01_id_bot/id_bot.py
Normal file
16
catch-all/06_bots_telegram/01_id_bot/id_bot.py
Normal file
@@ -0,0 +1,16 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user