Update bot.py
Browse files
bot.py
CHANGED
|
@@ -10,10 +10,7 @@ from app import generate_response # Import the response generation function fro
|
|
| 10 |
|
| 11 |
|
| 12 |
# Configure logging
|
| 13 |
-
logging.basicConfig(
|
| 14 |
-
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
| 15 |
-
level=logging.INFO
|
| 16 |
-
)
|
| 17 |
logger = logging.getLogger(__name__)
|
| 18 |
|
| 19 |
|
|
@@ -25,8 +22,7 @@ if not TOKEN:
|
|
| 25 |
|
| 26 |
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 27 |
"""
|
| 28 |
-
Handler for the /start command.
|
| 29 |
-
Replies with a welcome message.
|
| 30 |
"""
|
| 31 |
if not update.message or not update.message.text:
|
| 32 |
return
|
|
@@ -66,6 +62,6 @@ def main():
|
|
| 66 |
|
| 67 |
if __name__ == '__main__':
|
| 68 |
# Apply nest_asyncio to support nested event loops in HF Spaces
|
| 69 |
-
|
| 70 |
# For HF Spaces, using run_polling() is simpler and less dependent on DNS/HTTPS issues.
|
| 71 |
main()
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
# Configure logging
|
| 13 |
+
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
|
|
|
|
|
|
|
|
|
|
| 14 |
logger = logging.getLogger(__name__)
|
| 15 |
|
| 16 |
|
|
|
|
| 22 |
|
| 23 |
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 24 |
"""
|
| 25 |
+
Handler for the /start command. Replies with a welcome message.
|
|
|
|
| 26 |
"""
|
| 27 |
if not update.message or not update.message.text:
|
| 28 |
return
|
|
|
|
| 62 |
|
| 63 |
if __name__ == '__main__':
|
| 64 |
# Apply nest_asyncio to support nested event loops in HF Spaces
|
| 65 |
+
nest_asyncio.apply()
|
| 66 |
# For HF Spaces, using run_polling() is simpler and less dependent on DNS/HTTPS issues.
|
| 67 |
main()
|