mirror of
https://github.com/Lilac-Rose/Lacie.git
synced 2026-07-30 23:17:46 -05:00
merged suggest and profile commands
This commit is contained in:
parent
de41902c70
commit
376bf08fca
|
|
@ -1,87 +0,0 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
import asyncio
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
BOT_TOKEN = os.getenv('TOKEN')
|
||||
# Staff channel ID
|
||||
STAFF_CHANNEL_ID = 1211600723436109885
|
||||
|
||||
# Create bot instance
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
bot = commands.Bot(command_prefix="!", intents=intents)
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f'Logged in as {bot.user.name}')
|
||||
|
||||
# Get the staff channel
|
||||
channel = bot.get_channel(STAFF_CHANNEL_ID)
|
||||
if channel:
|
||||
# Create embed with moderation guide
|
||||
embed = discord.Embed(
|
||||
title="Staff Moderation Commands Guide",
|
||||
description="Quick reference for all moderation commands",
|
||||
color=0x00ff00
|
||||
)
|
||||
|
||||
# Add command fields
|
||||
embed.add_field(
|
||||
name="Warn",
|
||||
value="`!warn <user_id> <reason>`\nIssue a formal warning",
|
||||
inline=False
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Mute",
|
||||
value="`!mute <user_id> <duration> <reason>`\nTemporarily mute a user\n**Duration format:** 1w, 5d, 12h, 30m",
|
||||
inline=False
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Unmute",
|
||||
value="`!unmute <user_id>`\nRemove mute from user",
|
||||
inline=False
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Kick",
|
||||
value="`!kick <user_id> <reason>`\nRemove user from server",
|
||||
inline=False
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Ban",
|
||||
value="`!ban <user_id> <reason>`\nPermanently ban user",
|
||||
inline=False
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Clean Ban",
|
||||
value="`!cleanban <user_id> <days> <reason>`\nBan user and delete their messages\n**Days:** 1-7 days of messages to delete",
|
||||
inline=False
|
||||
)
|
||||
|
||||
embed.add_field(
|
||||
name="Infraction Management",
|
||||
value="`!inf search <user_id>` - Search user infractions\n`!inf list` - List all server infractions\n`!inf delete <infraction_id>` - Delete specific infraction",
|
||||
inline=False
|
||||
)
|
||||
|
||||
await channel.send(embed=embed)
|
||||
print("Guide sent successfully!")
|
||||
else:
|
||||
print("Could not find staff channel!")
|
||||
|
||||
await bot.close()
|
||||
|
||||
# Run the bot
|
||||
async def main():
|
||||
await bot.start(BOT_TOKEN)
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
|
@ -19,12 +19,14 @@ def list_fonts():
|
|||
fonts.append(os.path.splitext(f)[0])
|
||||
return fonts
|
||||
|
||||
class Profiles(commands.Cog):
|
||||
class Profiles(commands.GroupCog, name="profile"):
|
||||
"""Profile commands"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
setup_db()
|
||||
|
||||
@app_commands.command(name="listfonts", description="List all available fonts with a visual preview.")
|
||||
@app_commands.command(name="fonts", description="List all available fonts with a visual preview.")
|
||||
async def list_fonts_cmd(self, interaction: discord.Interaction):
|
||||
await interaction.response.defer(thinking=True)
|
||||
|
||||
|
|
@ -93,7 +95,7 @@ class Profiles(commands.Cog):
|
|||
file=discord.File(buffer, "font_preview.png")
|
||||
)
|
||||
|
||||
@app_commands.command(name="setprofile", description="Set your profile information.")
|
||||
@app_commands.command(name="set", description="Set your profile information.")
|
||||
@app_commands.describe(
|
||||
pronouns="Your pronouns",
|
||||
about_me="A short description about you",
|
||||
|
|
@ -102,7 +104,7 @@ class Profiles(commands.Cog):
|
|||
fav_game="Your favorite game",
|
||||
fav_artist="Your favorite music artist",
|
||||
birthday="Your birthday (MM-DD)",
|
||||
font_name="Font to use (see /listfonts)"
|
||||
font_name="Font to use (see /profile fonts)"
|
||||
)
|
||||
async def setprofile(self, interaction: discord.Interaction, pronouns: str = None, about_me: str = None, fav_color: str = None, bg_color: str = None, fav_game: str = None, fav_artist: str = None, birthday: str = None, font_name: str = None):
|
||||
# Defer the response to show "thinking"
|
||||
|
|
@ -121,7 +123,7 @@ class Profiles(commands.Cog):
|
|||
return
|
||||
|
||||
if font_name and font_name not in list_fonts():
|
||||
await interaction.followup.send("That font is not avaliable. use /listfonts to see the options.")
|
||||
await interaction.followup.send("That font is not avaliable. use /profile fonts to see the options.")
|
||||
return
|
||||
|
||||
db = get_db()
|
||||
|
|
@ -182,7 +184,7 @@ class Profiles(commands.Cog):
|
|||
|
||||
await interaction.followup.send("Your profile has been saved!")
|
||||
|
||||
@app_commands.command(name="profile", description="View your or another user's profile.")
|
||||
@app_commands.command(name="view", description="View your or another user's profile.")
|
||||
async def profile(self, interaction: discord.Interaction, member: discord.Member = None):
|
||||
# Defer immediately to show "thinking"
|
||||
await interaction.response.defer(thinking=True)
|
||||
|
|
@ -196,7 +198,7 @@ class Profiles(commands.Cog):
|
|||
db.close()
|
||||
|
||||
if not row:
|
||||
await interaction.followup.send("This user hasn't set up a profile yet. Use /setprofile to add information to your profile")
|
||||
await interaction.followup.send("This user hasn't set up a profile yet. Use /profile set to add information to your profile")
|
||||
return
|
||||
|
||||
_, pronouns, about_me, fav_color, bg_color, fav_game, fav_artist, birthday, font_name = row
|
||||
|
|
|
|||
|
|
@ -241,7 +241,9 @@ class PaginationView(discord.ui.View):
|
|||
await self.update_page(interaction)
|
||||
|
||||
|
||||
class Suggestion(commands.Cog):
|
||||
class Suggestion(commands.GroupCog, name="suggest"):
|
||||
"""Suggestion commands"""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.db_path = os.path.join(os.path.dirname(__file__), "suggestions.db")
|
||||
|
|
@ -283,7 +285,7 @@ class Suggestion(commands.Cog):
|
|||
if self.db:
|
||||
await self.db.close()
|
||||
|
||||
@app_commands.command(name="suggest", description="Submit a suggestion")
|
||||
@app_commands.command(name="submit", description="Submit a suggestion")
|
||||
async def suggest(self, interaction: discord.Interaction, idea: str):
|
||||
await interaction.response.defer(ephemeral=False)
|
||||
|
||||
|
|
@ -337,7 +339,7 @@ class Suggestion(commands.Cog):
|
|||
print(error_msg)
|
||||
await interaction.followup.send(error_msg[:2000])
|
||||
|
||||
@app_commands.command(name="viewsuggestion", description="View full details of a suggestion")
|
||||
@app_commands.command(name="view", description="View full details of a suggestion")
|
||||
async def viewsuggestion(self, interaction: discord.Interaction, suggestion_id: int):
|
||||
await interaction.response.defer(ephemeral=False)
|
||||
|
||||
|
|
@ -383,7 +385,7 @@ class Suggestion(commands.Cog):
|
|||
print(error_msg)
|
||||
await interaction.followup.send(error_msg[:2000])
|
||||
|
||||
@app_commands.command(name="completesuggestion", description="Mark an approved suggestion as completed (Admin only)")
|
||||
@app_commands.command(name="complete", description="Mark an approved suggestion as completed (Admin only)")
|
||||
async def completesuggestion(self, interaction: discord.Interaction, suggestion_id: int):
|
||||
await interaction.response.defer(ephemeral=False)
|
||||
|
||||
|
|
@ -424,7 +426,7 @@ class Suggestion(commands.Cog):
|
|||
print(error_msg)
|
||||
await interaction.followup.send(error_msg[:2000])
|
||||
|
||||
@app_commands.command(name="listsuggestions", description="List suggestions with optional status filter")
|
||||
@app_commands.command(name="list", description="List suggestions with optional status filter")
|
||||
@app_commands.choices(status=[
|
||||
app_commands.Choice(name="All", value="All"),
|
||||
app_commands.Choice(name="Pending", value="Pending"),
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ from discord import app_commands
|
|||
xp_group = app_commands.Group(name="xp", description="XP commands")
|
||||
|
||||
# Admin XP commands: /xpadmin set, /xpadmin add, /xpadmin remove, /xpadmin backup, etc.
|
||||
xp_admin_group = app_commands.Group(name="xpadmin", description="Admin XP management commands")
|
||||
xp_admin_group = app_commands.Group(name="xp_admin", description="Admin XP management commands")
|
||||
Loading…
Reference in New Issue
Block a user