Skip to content

Commit

Permalink
Merge pull request #100 from PavanTeja2005/telebot
Browse files Browse the repository at this point in the history
Added telegram bot feature.
  • Loading branch information
suryanshsk authored Oct 9, 2024
2 parents d1dd4df + 2c1dbb7 commit 8e838c1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions telegram_bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, CallbackContext

def telebot():
async def start(update: Update, context: CallbackContext) -> None:
"""Send a welcome message when the /start command is issued."""
await update.message.reply_text('Hello! I am your bot. Send me any message and I will echo it back!')

async def echo(update: Update, context: CallbackContext) -> None:
"""Echo the received message."""
await update.message.reply_text(update.message.text)

def main() -> None:
app = ApplicationBuilder().token("7854626087:AAF5ls0oB8XR3SvQhWkxmea42e7FSf0yKTE").build()

app.add_handler(CommandHandler("start", start))
app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo))

app.run_polling()
main()

if __name__ == '__main__':
telebot()

0 comments on commit 8e838c1

Please sign in to comment.