Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
PavanTeja2005 committed Oct 9, 2024
1 parent 71fab4f commit 2c1dbb7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
4 changes: 0 additions & 4 deletions sample.py

This file was deleted.

26 changes: 14 additions & 12 deletions telegram_bot.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, CallbackContext

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!')
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)
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("YOUR_API").build()
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.add_handler(CommandHandler("start", start))
app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo))

app.run_polling()
app.run_polling()
main()

if __name__ == '__main__':
main()
telebot()

0 comments on commit 2c1dbb7

Please sign in to comment.