Refactor bot server setup to use Waitress for production; fallback to Flask dev server for local development. Added timeout to HTTP requests in Fun and Test cogs. Improved error handling for missing environment variables. Enhanced secret key management in Flask app. Added request timeout configuration. Introduced new experimental features including user profile and balance cards, and a Tic-Tac-Toe game with Minimax AI. Addressed various database and security issues, and improved code quality across multiple files.
This commit is contained in:
+15
-8
@@ -28,9 +28,17 @@ class Client(commands.Bot):
|
||||
help_command=MyNewHelp(),
|
||||
)
|
||||
def iterate_prefix(self, prefix):
|
||||
prefixes = list(map(''.join, itertools.product(*zip(prefix.upper(), prefix.lower()))))
|
||||
print(prefixes)
|
||||
|
||||
# Avoid generating all case permutations for long prefixes.
|
||||
# Provide a small set of common-case variants and rely on
|
||||
# `case_insensitive=True` for command matching.
|
||||
variants = [prefix, prefix.lower(), prefix.upper()]
|
||||
# Preserve order but remove duplicates
|
||||
seen = set()
|
||||
prefixes = []
|
||||
for p in variants:
|
||||
if p not in seen:
|
||||
seen.add(p)
|
||||
prefixes.append(p)
|
||||
return prefixes
|
||||
|
||||
async def setup_hook(self): # overwriting a handler
|
||||
@@ -48,11 +56,10 @@ class Client(commands.Bot):
|
||||
def main():
|
||||
load_dotenv()
|
||||
client = Client()
|
||||
token = "ODA2Mjg0OTY2NzQ0NTU1NjAw.GFQoZn.Jh0OJ7KczDOfRxFFESnAPOiodUAkjSyjQ-ClGg"
|
||||
if token is not None:
|
||||
client.run(token)
|
||||
else:
|
||||
print("Token is missing.")
|
||||
token = os.getenv("DISCORD_TOKEN") or os.getenv("TOKEN")
|
||||
if not token:
|
||||
raise SystemExit("ERROR: Discord token not found. Set DISCORD_TOKEN (or TOKEN) in environment.")
|
||||
client.run(token)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user