Lightarmortech commited on
Commit
7fdecc7
·
verified ·
1 Parent(s): 6d30550

Delete Bot

Browse files
Files changed (1) hide show
  1. Bot +0 -94
Bot DELETED
@@ -1,94 +0,0 @@
1
- $ pip install python-telegram-bot --upgrade
2
-
3
- import logging
4
- import random
5
- from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
6
- from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, CallbackQueryHandler
7
-
8
- # Enable logging
9
- logging.basicConfig(
10
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
11
- level=logging.INFO
12
- )
13
- logger = logging.getLogger(__name__)
14
-
15
- # Fun fact list
16
- fun_facts = [
17
- "Did you know? Honey never spoils.",
18
- "Fact: Bananas are berries, but strawberries aren't.",
19
- "Fun Fact: Octopuses have three hearts!",
20
- "Legendary: The Eiffel Tower can grow by 6 inches in summer due to heat expansion.",
21
- "Myth or fact? You can't hum while holding your nose closed."
22
- ]
23
-
24
- # Start command
25
- async def start(update: Update, context) -> None:
26
- await update.message.reply_text(
27
- f"Welcome to the legendary Error404Bot!\nI'm here to assist you with the best features.\nUse /help to see more commands."
28
- )
29
-
30
- # Help command
31
- async def help_command(update: Update, context) -> None:
32
- await update.message.reply_text(
33
- "/start - Start interacting with the bot.\n"
34
- "/welcome - Sends a custom welcome message.\n"
35
- "/fact - Get a fun fact."
36
- )
37
-
38
- # Welcome message function
39
- async def welcome(update: Update, context) -> None:
40
- user = update.effective_user
41
- welcome_text = f"Welcome, {user.first_name}, to the legendary Error404Bot community! Prepare to be amazed. 😎"
42
-
43
- keyboard = [
44
- [InlineKeyboardButton("Learn More", callback_data='learn_more')],
45
- [InlineKeyboardButton("Support", callback_data='support')]
46
- ]
47
- reply_markup = InlineKeyboardMarkup(keyboard)
48
-
49
- await update.message.reply_text(welcome_text, reply_markup=reply_markup)
50
-
51
- # Fun fact feature
52
- async def send_fun_fact(update: Update, context) -> None:
53
- fact = random.choice(fun_facts)
54
- await update.message.reply_text(fact)
55
-
56
- # Button handler (for Learn More and Support)
57
- async def button(update: Update, context) -> None:
58
- query = update.callback_query
59
- await query.answer()
60
-
61
- if query.data == 'learn_more':
62
- await query.edit_message_text(text="This bot is designed to provide legendary services and features.")
63
- elif query.data == 'support':
64
- await query.edit_message_text(text="Support is on the way! Please wait for a response or contact @support.")
65
-
66
- # Error handler
67
- async def error_handler(update: object, context) -> None:
68
- logger.error(msg="Exception while handling an update:", exc_info=context.error)
69
-
70
- # Main function to run the bot
71
- async def main() -> None:
72
- # Create the Application and pass it your bot's token.
73
- application = ApplicationBuilder().token("7813873560:AAFW6_I_n9OYgbycJZsL92ns1SuXsrYLTI0").build()
74
-
75
- # Register command handlers
76
- application.add_handler(CommandHandler("start", start))
77
- application.add_handler(CommandHandler("help", help_command))
78
- application.add_handler(CommandHandler("welcome", welcome))
79
- application.add_handler(CommandHandler("fact", send_fun_fact))
80
-
81
- # Button handler for interactive buttons
82
- application.add_handler(CallbackQueryHandler(button))
83
-
84
- # Log all errors
85
- application.add_error_handler(error_handler)
86
-
87
- # Start the bot
88
- await application.start_polling()
89
- await application.idle()
90
-
91
- # Run the bot
92
- if __name__ == '__main__':
93
- import asyncio
94
- asyncio.run(main())