How to create a Telegram bot with Python in under 10 min! – Telegram Group

How to create a Telegram bot with Python in under 10 min!

Steps to create your bot:

Configuration steps for the bot:

pip install python-telegram-bot
from telegram.ext.updater import Updater
from telegram.update import Update
from telegram.ext.callbackcontext import CallbackContext
from telegram.ext.commandhandler import CommandHandler
from telegram.ext.messagehandler import MessageHandler
from telegram.ext.filters import Filters
updater = Updater("your_own_API_Token got from BotFather", use_context=True)def start(update: Update, context: CallbackContext):
update.message.reply_text("Enter the text you want to show to
the user whenever they start the bot")
def help(update: Update, context: CallbackContext):  
update.message.reply_text("Your Message")
def gmail_url(update: Update, context: CallbackContext):
update.message.reply_text("gmail link here")def youtube_url(update: Update, context: CallbackContext):
update.message.reply_text("youtube link")def linkedIn_url(update: Update, context: CallbackContext):
update.message.reply_text("Your linkedin profile url")def unknown_text(update: Update, context: CallbackContext):
update.message.reply_text("Sorry I can't recognize you , you
said '%s'" % update.message.text)def unknown(update: Update, context: CallbackContext):
update.message.reply_text("Sorry '%s' is not a valid command" %
update.message.text)
updater.dispatcher.add_handler(CommandHandler('start', start))
updater.dispatcher.add_handler(CommandHandler('youtube', youtube_url))
updater.dispatcher.add_handler(CommandHandler('help', help))
updater.dispatcher.add_handler(CommandHandler('linkedin', linkedIn_url))
updater.dispatcher.add_handler(CommandHandler('gmail', gmail_url))
updater.dispatcher.add_handler(MessageHandler(Filters.text, unknown))
# Filters out unknown commands
updater.dispatcher.add_handler(MessageHandler(Filters.command, unknown))
# Filters out unknown messages.
updater.dispatcher.add_handler(MessageHandler(Filters.text, unknown_text))
updater.start_polling()
from telegram.ext.updater import Updater
from telegram.update import Update
from telegram.ext.callbackcontext import CallbackContext
from telegram.ext.commandhandler import CommandHandler
from telegram.ext.messagehandler import MessageHandler
from telegram.ext.filters import Filters

updater = Updater("your_own_API_Token got from BotFather",
use_context=True)

def start(update: Update, context: CallbackContext):
update.message.reply_text(
"Hello sir, Welcome to the Bot. Please write /help to see
the commands available.")

def help(update: Update, context: CallbackContext):
update.message.reply_text("""Available Commands :-
/youtube - To get the youtube URL
/linkedin - To get the LinkedIn profile URL
/gmail - To get gmail URL""")

def gmail_url(update: Update, context: CallbackContext):
update.message.reply_text(
"Your gmail link here (I am not giving mine one for security
reasons)")

def youtube_url(update: Update, context: CallbackContext):
update.message.reply_text("Youtube Link =>\
www.youtube.com/")

def linkedIn_url(update: Update, context: CallbackContext):
update.message.reply_text(
"LinkedIn URL => \
www.linkedin.com/in/denizshabani/")

def unknown(update: Update, context: CallbackContext):
update.message.reply_text(
"Sorry '%s' is not a valid command" % update.message.text)

def unknown_text(update: Update, context: CallbackContext):
update.message.reply_text(
"Sorry I can't recognize you , you said '%s'" %
update.message.text)

updater.dispatcher.add_handler(CommandHandler('start', start))
updater.dispatcher.add_handler(CommandHandler('youtube', youtube_url))
updater.dispatcher.add_handler(CommandHandler('help', help))
updater.dispatcher.add_handler(CommandHandler('linkedin', linkedIn_url))
updater.dispatcher.add_handler(CommandHandler('gmail', gmail_url))
updater.dispatcher.add_handler(MessageHandler(Filters.text, unknown))
# Filters out unknown commands
updater.dispatcher.add_handler(MessageHandler(Filters.command, unknown))
# Filters out unknown messages.
updater.dispatcher.add_handler(MessageHandler(Filters.text, unknown_text))

updater.start_polling()

Deniz Shabani

If you like what I do then please support me!

www.buymeacoffee.com

Ten articles before and after

Телеграм бот для уведомлений об ордерах Binance – Telegram Group

IntruderDet —An Intruder Detection Bot for my Appartment – Telegram Group

Send APK automatically to Telegram using Dart/Flutter – Telegram Group

How to build a Telegram bot to show Chainlink price feeds – Telegram Group

Simple Telegram Bot using API’s. A Simple Telegram Bot which can respond… – Telegram Group

Monitor Server with Telegram Bot and Python – Telegram Group

Google Sheets Formula & Telegram Message ✈️ – Telegram Group

How to Create a Telegram Chatbot in 2022 – Telegram Group

Telegram Bot 跟我想的不一樣. 第一天進公司時,Slack就被邀進同事們訂便當的群組,在上面會宣布今天訂那一家便… – Telegram Group

TRX1 Dev Blog #11 (November 2021) – Telegram Group