Skip to content

Instantly share code, notes, and snippets.

@kmye
Created April 15, 2022 02:59
Show Gist options
  • Save kmye/feaf99d3e492887ed2081914297a2ceb to your computer and use it in GitHub Desktop.
Save kmye/feaf99d3e492887ed2081914297a2ceb to your computer and use it in GitHub Desktop.
Telethron Bot Send Message
from telethon.sync import TelegramClient
from telethon import Button, types
api_id = 123456 # replace with your chat id
api_hash = 'replace_with_api_hash'
bot_token = 'bot_token_from_your_bot_father'
CHAT_ID = -123456 # replace with your chat id
bot = TelegramClient('bot', api_id, api_hash).start(bot_token=bot_token)
with bot:
bot.send_message(types.PeerChannel(CHAT_ID), 'Bye Keyboard!', buttons=Button.clear())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment