Last active
September 10, 2019 11:22
-
-
Save enric1994/a3e1f2fc62ca27a6be1cbaeb54f64fb9 to your computer and use it in GitHub Desktop.
Simple Telegram bot for Python 2.7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
#pip install telebot | |
import telebot | |
# Step 1. Create a bot and get the API key using the BotFather: https://telegram.me/BotFather | |
telegramToken='INSERT_API_KEY_HERE' | |
# Step 2. Start a conversation with your new bot using the /start command | |
# Step 3. Get your user ID using this bot: https://telegram.me/userinfobot | |
telegramChatID=1234 | |
def send(message): | |
bot = telebot.TeleBot(telegramToken) | |
bot.config['api_key'] = telegramToken | |
bot.send_message(int(telegramChatID), message) | |
print(message) | |
send("Hello Telegram!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment