Fix des derniers détails
This commit is contained in:
parent
07198c20b7
commit
00446c5fb8
3 changed files with 130 additions and 21 deletions
|
|
@ -567,7 +567,16 @@ class TicketPriorityModal(discord.ui.Modal):
|
|||
|
||||
try:
|
||||
category_channel = None
|
||||
if self.config.default_category:
|
||||
|
||||
# Check if category has a specific Discord category
|
||||
if self.category.discord_category_id:
|
||||
try:
|
||||
category_channel = guild.get_channel(int(self.category.discord_category_id))
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
|
||||
# Fallback to default config category if not found or not set
|
||||
if not category_channel and self.config.default_category:
|
||||
try:
|
||||
category_channel = guild.get_channel(int(self.config.default_category))
|
||||
except (ValueError, TypeError):
|
||||
|
|
@ -2214,7 +2223,8 @@ class CategoryActionView(discord.ui.View):
|
|||
f"**Emoji:** {self.category.emoji}\n"
|
||||
f"**Description:** {self.category.description or 'Aucune'}\n"
|
||||
f"**Couleur:** `{self.category.color}`\n"
|
||||
f"**Staff Spécifique:** {', '.join([f'<@&{r}>' for r in self.category.staff_roles]) if self.category.staff_roles else 'Global (Tous les staffs)'}",
|
||||
f"**Staff Spécifique:** {', '.join([f'<@&{r}>' for r in self.category.staff_roles]) if self.category.staff_roles else 'Global (Tous les staffs)'}\n"
|
||||
f"**Catégorie Discord:** {f'<#{self.category.discord_category_id}>' if self.category.discord_category_id else 'Par défaut'}",
|
||||
color=discord.Color.blue()
|
||||
)
|
||||
return embed
|
||||
|
|
@ -2236,6 +2246,17 @@ class CategoryActionView(discord.ui.View):
|
|||
)
|
||||
await interaction.response.edit_message(embed=embed, view=view)
|
||||
|
||||
@discord.ui.button(label="📁 Catégorie Discord", style=discord.ButtonStyle.secondary)
|
||||
async def discord_category_callback(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
view = CategoryDiscordCategoryView(self.bot, self.storage, self.config, self.category, self)
|
||||
embed = discord.Embed(
|
||||
title=f"Catégorie Discord: {self.category.name}",
|
||||
description="Choisissez la catégorie Discord (dossier) dans laquelle les tickets de ce type seront créés.\n\n"
|
||||
"Si aucune n'est sélectionnée, la catégorie par défaut du serveur sera utilisée.",
|
||||
color=discord.Color.blue()
|
||||
)
|
||||
await interaction.response.edit_message(embed=embed, view=view)
|
||||
|
||||
@discord.ui.button(label="🗑️ Supprimer", style=discord.ButtonStyle.danger)
|
||||
async def delete_callback(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
view = DeleteCategoryConfirmationView(self.bot, self.storage, self.config, self.category, self.parent_view)
|
||||
|
|
@ -2276,6 +2297,33 @@ class CategoryPermissionsView(discord.ui.View):
|
|||
async def back_callback(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
await interaction.response.edit_message(embed=self.parent_view._get_embed(), view=self.parent_view)
|
||||
|
||||
class CategoryDiscordCategoryView(discord.ui.View):
|
||||
"""Vue pour configurer la catégorie Discord d'une catégorie de ticket"""
|
||||
|
||||
def __init__(self, bot, storage, config, category, parent_view):
|
||||
super().__init__(timeout=None)
|
||||
self.bot = bot
|
||||
self.storage = storage
|
||||
self.config = config
|
||||
self.category = category
|
||||
self.parent_view = parent_view
|
||||
|
||||
@discord.ui.select(cls=discord.ui.ChannelSelect, channel_types=[discord.ChannelType.category], placeholder="Sélectionner la catégorie Discord")
|
||||
async def select_callback(self, interaction: discord.Interaction, select: discord.ui.ChannelSelect):
|
||||
self.category.discord_category_id = select.values[0].id
|
||||
self.storage.save_config(interaction.guild_id, self.config)
|
||||
await interaction.response.edit_message(embed=self.parent_view._get_embed(), view=self.parent_view)
|
||||
|
||||
@discord.ui.button(label="❌ Réinitialiser", style=discord.ButtonStyle.danger)
|
||||
async def reset_callback(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
self.category.discord_category_id = None
|
||||
self.storage.save_config(interaction.guild_id, self.config)
|
||||
await interaction.response.edit_message(embed=self.parent_view._get_embed(), view=self.parent_view)
|
||||
|
||||
@discord.ui.button(label="⬅️ Retour", style=discord.ButtonStyle.secondary)
|
||||
async def back_callback(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
await interaction.response.edit_message(embed=self.parent_view._get_embed(), view=self.parent_view)
|
||||
|
||||
|
||||
class DeleteCategoryConfirmationView(discord.ui.View):
|
||||
def __init__(self, bot, storage, config, category, parent_view):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue