Initial commit: bot Discord Vicy V1.8
This commit is contained in:
commit
56958c5832
70 changed files with 8469 additions and 0 deletions
38
commandes/presence_session.py
Normal file
38
commandes/presence_session.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
# Import ou partage de presence_data selon l'architecture
|
||||
from commandes.annonces_sessions import presence_data # adapte le chemin si besoin
|
||||
|
||||
class ListePresence(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@app_commands.command(
|
||||
name="liste_presence",
|
||||
description="Liste les présences pour une session RP."
|
||||
)
|
||||
@app_commands.describe(
|
||||
message_id="ID du message d'annonce"
|
||||
)
|
||||
async def liste_presence(self, interaction: discord.Interaction, message_id: str):
|
||||
try:
|
||||
mid = int(message_id)
|
||||
except ValueError:
|
||||
await interaction.response.send_message("ID de message invalide.", ephemeral=True)
|
||||
return
|
||||
if mid not in presence_data:
|
||||
await interaction.response.send_message("Aucune donnée de présence pour ce message.", ephemeral=True)
|
||||
return
|
||||
data = presence_data[mid]
|
||||
def mentions(ids):
|
||||
return ', '.join(f"<@{uid}>" for uid in ids) if ids else "Aucun"
|
||||
await interaction.response.send_message(
|
||||
f"**Présents ({len(data['present'])})** : {mentions(data['present'])}\n"
|
||||
f"**Absents ({len(data['absent'])})** : {mentions(data['absent'])}\n"
|
||||
f"**En retard ({len(data['retard'])})** : {mentions(data['retard'])}",
|
||||
ephemeral=True
|
||||
)
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(ListePresence(bot))
|
||||
Loading…
Add table
Add a link
Reference in a new issue