Correction mineurs système de ticket & fix de l'erreur "!! CommandeNotfound"
This commit is contained in:
parent
dfec6b2418
commit
33fd07b842
16 changed files with 30 additions and 2868 deletions
|
|
@ -694,6 +694,7 @@ class TicketManagementView(discord.ui.View):
|
|||
"author_name": str(msg.author),
|
||||
"content": msg.content,
|
||||
"timestamp": msg.created_at.isoformat(),
|
||||
"attachments": [a.url for a in msg.attachments],
|
||||
"is_staff": self._is_staff_member(msg.author)
|
||||
})
|
||||
|
||||
|
|
@ -788,6 +789,8 @@ class TicketManagementView(discord.ui.View):
|
|||
return user.guild_permissions.administrator
|
||||
|
||||
def _is_staff_member(self, member) -> bool:
|
||||
if not isinstance(member, discord.Member):
|
||||
return False
|
||||
guild = member.guild
|
||||
for role_id in self.config.staff_roles:
|
||||
role = guild.get_role(int(role_id))
|
||||
|
|
@ -795,7 +798,6 @@ class TicketManagementView(discord.ui.View):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
class CloseTicketModal(discord.ui.Modal):
|
||||
"""Modal pour fermer un ticket"""
|
||||
|
||||
|
|
@ -894,6 +896,7 @@ class CloseTicketModal(discord.ui.Modal):
|
|||
"author_name": str(msg.author),
|
||||
"content": msg.content,
|
||||
"timestamp": msg.created_at.isoformat(),
|
||||
"attachments": [a.url for a in msg.attachments],
|
||||
"is_staff": self._is_staff_member(msg.author)
|
||||
})
|
||||
|
||||
|
|
@ -958,6 +961,16 @@ class CloseTicketModal(discord.ui.Modal):
|
|||
return True
|
||||
return user.guild_permissions.administrator
|
||||
|
||||
def _is_staff_member(self, member) -> bool:
|
||||
if not isinstance(member, discord.Member):
|
||||
return False
|
||||
guild = member.guild
|
||||
for role_id in self.config.staff_roles:
|
||||
role = guild.get_role(int(role_id))
|
||||
if role and role in member.roles:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class TicketSetupView(discord.ui.View):
|
||||
"""Panel de configuration complet du système de tickets"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue