Skip to content

Commit b5f0135

Browse files
Your Nameaider-chat-bot
andcommitted
refactor: clean up bot.py logic and update dependencies
Co-authored-by: aider (gemini/gemini-3-flash-preview) <aider@aider.chat>
1 parent 80e78b2 commit b5f0135

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

bot.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import json
44
import os
55
from dotenv import load_dotenv
6+
import re
67
from threading import Thread
78
from flask import Flask
8-
import re
99

1010
app = Flask(__name__)
1111

@@ -17,9 +17,6 @@ def run_web():
1717
port = int(os.environ.get("PORT", 8080))
1818
app.run(host="0.0.0.0", port=port)
1919

20-
# Start web server in a separate thread
21-
Thread(target=run_web).start()
22-
2320
# Load .env file
2421
load_dotenv()
2522
TOKEN = os.getenv("DISCORD_TOKEN")
@@ -28,9 +25,7 @@ def run_web():
2825
intents = discord.Intents.default()
2926
intents.message_content = True
3027
intents.reactions = True
31-
intents.messages = True
32-
intents.guilds = True
33-
intents.members = True # helps with mentions
28+
intents.members = True
3429

3530
bot = commands.Bot(command_prefix="!", intents=intents)
3631

@@ -100,4 +95,7 @@ async def count_expressions(ctx, message: str):
10095
expressions = re.findall(r'\b\w+\b', message)
10196
await ctx.send(f"The message contains {len(expressions)} expressions.")
10297

103-
bot.run(TOKEN)
98+
if __name__ == "__main__":
99+
# Start web server in a separate thread
100+
Thread(target=run_web, daemon=True).start()
101+
bot.run(TOKEN)

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
discord.py
22
python-dotenv
33
flask
4+
gunicorn

0 commit comments

Comments
 (0)