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
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger("vision")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CustomMessages(commands.Cog):
|
|
|
|
|
def __init__(self, bot: commands.Bot):
|
|
|
|
|
self.bot = bot
|
|
|
|
|
|
|
|
|
|
@app_commands.command(name="botstatus", description="Changer le statut du bot")
|
|
|
|
|
@app_commands.describe(text="Texte du statut", type_type="Type: playing, watching, listening")
|
|
|
|
|
@app_commands.checks.has_permissions(manage_guild=True)
|
|
|
|
|
async def botstatus(self, interaction: discord.Interaction, text: str, type_type: str = "playing"):
|
|
|
|
|
activities = {
|
|
|
|
|
"playing": discord.ActivityType.playing,
|
|
|
|
|
"watching": discord.ActivityType.watching,
|
|
|
|
|
"listening": discord.ActivityType.listening,
|
|
|
|
|
"streaming": discord.ActivityType.streaming,
|
|
|
|
|
}
|
|
|
|
|
activity_type = activities.get(type_type.lower(), discord.ActivityType.playing)
|
|
|
|
|
activity = discord.Activity(type=activity_type, name=text)
|
|
|
|
|
await self.bot.change_presence(activity=activity)
|
|
|
|
|
await interaction.response.send_message(f"Statut changé : **{text}**", ephemeral=True)
|
|
|
|
|
|
|
|
|
|
@app_commands.command(name="custom_send", description="Envoyer un message custom")
|
|
|
|
|
@app_commands.describe(channel="Canal", message="Contenu", title="Titre de l'embed")
|
|
|
|
|
@app_commands.checks.has_permissions(manage_guild=True)
|
|
|
|
|
async def custom_send(
|
|
|
|
|
self, interaction: discord.Interaction, channel: discord.TextChannel, message: str, title: str = ""
|
|
|
|
|
):
|
|
|
|
|
if title:
|
2026-10-04 20:07:10 +02:00
|
|
|
embed = discord.Embed(title=title, description=message, 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
|
|
|
await channel.send(embed=embed)
|
|
|
|
|
else:
|
|
|
|
|
await channel.send(message)
|
|
|
|
|
await interaction.response.send_message(f"Message envoyé dans {channel.mention}", ephemeral=True)
|
|
|
|
|
|
|
|
|
|
@app_commands.command(name="embed", description="Envoyer un embed personnalisé")
|
|
|
|
|
@app_commands.describe(
|
|
|
|
|
channel="Canal", title="Titre", description="Description", color="Couleur (hex)", image_url="Image"
|
|
|
|
|
)
|
|
|
|
|
@app_commands.checks.has_permissions(manage_guild=True)
|
|
|
|
|
async def embed(
|
|
|
|
|
self,
|
|
|
|
|
interaction: discord.Interaction,
|
|
|
|
|
channel: discord.TextChannel,
|
|
|
|
|
title: str,
|
|
|
|
|
description: str,
|
2026-10-04 20:07:10 +02:00
|
|
|
color: str = "#2f3136",
|
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
|
|
|
image_url: str = "",
|
|
|
|
|
):
|
|
|
|
|
try:
|
|
|
|
|
color_int = int(color.lstrip("#"), 16)
|
|
|
|
|
except ValueError:
|
2026-10-04 20:07:10 +02:00
|
|
|
color_int = 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
|
|
|
|
|
|
|
|
embed = discord.Embed(title=title, description=description, color=color_int)
|
|
|
|
|
if image_url:
|
|
|
|
|
embed.set_image(url=image_url)
|
|
|
|
|
embed.set_footer(text=f"Envoyé par {interaction.user}")
|
|
|
|
|
|
|
|
|
|
await channel.send(embed=embed)
|
|
|
|
|
await interaction.response.send_message(f"Embed envoyé dans {channel.mention}", ephemeral=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def setup(bot: commands.Bot):
|
|
|
|
|
await bot.add_cog(CustomMessages(bot))
|