feat: full feature suite — welcome, modmail, security, staff, avis, rules, links, shop, custom
features/shared.py: per-guild JSON config store
features/welcome.py: on_member_join message + invite tracking + /invites
features/modmail.py: DM-based tickets with staff relay
features/security.py: antiraid (join rate detection), ban protection, join/leave log
features/staff.py: staff ranks, promote/demote, /staff_list
features/avis.py: /avis modal -> embed in configured channel
features/rules.py: /rules_setup with accept button + role assignment
features/links.py: /links panel, /links_setup, /links_remove
features/shop.py: /shop_announce new product embeds
features/custom.py: /botstatus, /custom_send, /embed
2026-10-02 19:45:46 +02:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
import discord
|
|
|
|
|
from discord import app_commands
|
|
|
|
|
from discord.ext import commands
|
|
|
|
|
|
|
|
|
|
from features import shared
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger("vision")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Shop(commands.Cog):
|
|
|
|
|
def __init__(self, bot: commands.Bot):
|
|
|
|
|
self.bot = bot
|
|
|
|
|
|
|
|
|
|
@app_commands.command(name="shop_setup", description="Configurer les annonces boutique")
|
|
|
|
|
@app_commands.describe(channel="Canal des annonces boutique")
|
|
|
|
|
@app_commands.checks.has_permissions(manage_guild=True)
|
|
|
|
|
async def shop_setup(self, interaction: discord.Interaction, channel: discord.TextChannel):
|
|
|
|
|
shared.set(interaction.guild_id, "shop", {"channel_id": channel.id, "enabled": True})
|
|
|
|
|
await interaction.response.send_message(f"Annonces boutique dans {channel.mention}", ephemeral=True)
|
|
|
|
|
|
|
|
|
|
@app_commands.command(name="shop_announce", description="Annoncer un nouveau produit")
|
|
|
|
|
@app_commands.describe(name="Nom du produit", description="Description", price="Prix", image_url="URL de l'image")
|
|
|
|
|
@app_commands.checks.has_permissions(manage_guild=True)
|
|
|
|
|
async def shop_announce(
|
|
|
|
|
self,
|
|
|
|
|
interaction: discord.Interaction,
|
|
|
|
|
name: str,
|
|
|
|
|
description: str,
|
|
|
|
|
price: str = "",
|
|
|
|
|
image_url: str = "",
|
|
|
|
|
):
|
|
|
|
|
cfg = shared.section(interaction.guild_id, "shop")
|
|
|
|
|
if not cfg.get("enabled"):
|
|
|
|
|
await interaction.response.send_message("Boutique non configurée.", ephemeral=True)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
channel = interaction.guild.get_channel(cfg["channel_id"])
|
|
|
|
|
if not channel:
|
|
|
|
|
await interaction.response.send_message("Canal boutique introuvable.", ephemeral=True)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
embed = discord.Embed(
|
|
|
|
|
title=f"🆕 Nouveau produit — {name}",
|
|
|
|
|
description=description,
|
2026-10-04 20:07:10 +02:00
|
|
|
color=0x2F3136,
|
feat: full feature suite — welcome, modmail, security, staff, avis, rules, links, shop, custom
features/shared.py: per-guild JSON config store
features/welcome.py: on_member_join message + invite tracking + /invites
features/modmail.py: DM-based tickets with staff relay
features/security.py: antiraid (join rate detection), ban protection, join/leave log
features/staff.py: staff ranks, promote/demote, /staff_list
features/avis.py: /avis modal -> embed in configured channel
features/rules.py: /rules_setup with accept button + role assignment
features/links.py: /links panel, /links_setup, /links_remove
features/shop.py: /shop_announce new product embeds
features/custom.py: /botstatus, /custom_send, /embed
2026-10-02 19:45:46 +02:00
|
|
|
)
|
|
|
|
|
if price:
|
|
|
|
|
embed.add_field(name="💰 Prix", value=price, inline=True)
|
|
|
|
|
if image_url:
|
|
|
|
|
embed.set_image(url=image_url)
|
|
|
|
|
|
|
|
|
|
embed.set_footer(text=f"Annoncé par {interaction.user}")
|
|
|
|
|
await channel.send(embed=embed)
|
|
|
|
|
await interaction.response.send_message(f"Annonce envoyée dans {channel.mention}", ephemeral=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def setup(bot: commands.Bot):
|
|
|
|
|
await bot.add_cog(Shop(bot))
|