Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from telegram import Update
|
2 |
+
from telegram.ext import Updater, CommandHandler, CallbackContext
|
3 |
+
|
4 |
+
# Function to start the bot and reply with a welcome message
|
5 |
+
def start(update: Update, context: CallbackContext) -> None:
|
6 |
+
update.message.reply_text('Hello! I am your bot. How can I help you today?')
|
7 |
+
|
8 |
+
# Function to handle the /help command
|
9 |
+
def help_command(update: Update, context: CallbackContext) -> None:
|
10 |
+
update.message.reply_text('Use /start to get started with the bot.')
|
11 |
+
|
12 |
+
# Main function to set up the bot
|
13 |
+
def main():
|
14 |
+
# Your bot token (replace with your actual bot token)
|
15 |
+
token = '7714605375:AAEfd-D1Y1np-HBJ0jOR1vGfyNJD2hloPAc'
|
16 |
+
|
17 |
+
# Create the Updater and pass it your bot's token
|
18 |
+
updater = Updater(token)
|
19 |
+
|
20 |
+
# Get the dispatcher to register handlers
|
21 |
+
dispatcher = updater.dispatcher
|
22 |
+
|
23 |
+
# Register handlers for commands
|
24 |
+
dispatcher.add_handler(CommandHandler("start", start))
|
25 |
+
dispatcher.add_handler(CommandHandler("help", help_command))
|
26 |
+
|
27 |
+
# Start the Bot
|
28 |
+
updater.start_polling()
|
29 |
+
|
30 |
+
# Run the bot until you send a signal (Ctrl+C)
|
31 |
+
updater.idle()
|
32 |
+
|
33 |
+
if __name__ == '__main__':
|
34 |
+
main()
|