Python – TelegramAPI

Table of Contents

Intro

Short Intro in to Telegram API with pyTelegramBotAP

Instructions

Code

				
					import telebot

TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = YOUR_CHAT_ID

bot = telebot.TeleBot(TOKEN)

bot.send_message(CHAT_ID, "I'm a big fat dick")

photo = open('img/wobi_512.png', 'rb')
bot.send_photo(CHAT_ID, photo)


@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
    bot.reply_to(message, "Howdy, how are you doing?")


@bot.message_handler(func=lambda message: True)
def echo_all(message):
    bot.reply_to(message, message.text)


bot.polling()

				
			

Leave a Reply