Simple async python 3 telegram bot using fast aiohttp requests
View at: https://test.pypi.org/project/py3tgbot
pip3 install py3tgbot
import asyncio
from py3tgbot import TgBotJson
TGBOT_TOKEN = "12345:YOUR_TOKEN"
APP_HOSTNAME = "https://YOUR_HOSTNAME.ngrok.io"
CHAT_ID = 123456789 # your chat id
client_tgbot = TgBotJson(token=TGBOT_TOKEN)
async def main_async():
response = await app.client_tgbot.setWebhook("{hostname}/tgbot/wh".format(hostname=APP_HOSTNAME))
r = await response.json()
print(r)
response = await app.client_tgbot.sendMessage(CHAT_ID, "Hello from Telegram Bot!")
r = await response.json()
print(r)
if __name__ == "__main__":
asyncio.run_until_complete(main_async())
- How to publish pypi package Medium article in Russian