Fixed: Incidents now have a red border instead of green when reporting it.
Fixed: Made the Funny Moments a context command instead of slash command Updated: Changed the status for now to be related to what's being worked on.
This commit is contained in:
26
main.py
26
main.py
@ -6,6 +6,7 @@ from dotenv import load_dotenv
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
# Configuration
|
||||
class Settings(BaseSettings):
|
||||
DISCORD_TOKEN: str
|
||||
DISCORD_GUILD: int
|
||||
@ -17,7 +18,8 @@ class Settings(BaseSettings):
|
||||
|
||||
config = Settings()
|
||||
|
||||
# Initialize logging
|
||||
|
||||
# Logging setup
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s | %(levelname)s | %(message)s",
|
||||
@ -35,23 +37,35 @@ class EmeraldClient(discord.Client):
|
||||
self.tree = app_commands.CommandTree(self)
|
||||
|
||||
async def setup_hook(self):
|
||||
"""Sync commands with test guild"""
|
||||
# Load commands
|
||||
from commands.moments import setup as moments_setup
|
||||
await moments_setup(self)
|
||||
|
||||
# Sync commands
|
||||
guild = discord.Object(id=config.DISCORD_GUILD)
|
||||
self.tree.copy_global_to(guild=guild)
|
||||
await self.tree.sync(guild=guild)
|
||||
logging.info("Commands synced to guild")
|
||||
logging.info("Commands synced")
|
||||
|
||||
async def on_ready(self):
|
||||
logging.info(f"Logged in as {self.user} (ID: {self.user.id})")
|
||||
logging.info(f"Logged in as {self.user}")
|
||||
await self.change_presence(activity=discord.Activity(
|
||||
type=discord.ActivityType.listening,
|
||||
name="your requests"
|
||||
name="/moments"
|
||||
))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
load_dotenv()
|
||||
client = EmeraldClient()
|
||||
client.run(config.DISCORD_TOKEN)
|
||||
|
||||
# Global error handler
|
||||
@client.tree.error
|
||||
async def on_error(interaction: discord.Interaction, error):
|
||||
logging.error(f"Error: {error}")
|
||||
await interaction.response.send_message(
|
||||
"⚠️ Something went wrong. Please try again.",
|
||||
ephemeral=True
|
||||
)
|
||||
|
||||
client.run(config.DISCORD_TOKEN)
|
||||
|
Reference in New Issue
Block a user