16 lines
471 B
Python
16 lines
471 B
Python
from telegram import Bot
|
|
import asyncio
|
|
|
|
# Configura tu bot con el token de BotFather
|
|
TOKEN = "7626026035:AAHEMp_iIN3y8AwywL0R6OTQvNi7EcJZ0iY"
|
|
CHAT_ID = "-123456789" # Reemplaza con el ID del grupo
|
|
|
|
bot = Bot(token=TOKEN)
|
|
|
|
async def enviar_mensaje(mensaje: str):
|
|
await bot.send_message(chat_id=CHAT_ID, text=mensaje)
|
|
|
|
# Para ejecutar la función de forma síncrona cuando sea necesario
|
|
def enviar_mensaje_sync(mensaje: str):
|
|
asyncio.run(enviar_mensaje(mensaje))
|