Migration de Kuby vers disnake
This commit is contained in:
parent
dc6e235f27
commit
c8c579eefe
36 changed files with 1205 additions and 1253 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
import disnake
|
||||
from disnake.ext import commands
|
||||
import json
|
||||
import os
|
||||
from collections import deque
|
||||
|
|
@ -28,7 +28,7 @@ class AntiSpam(commands.Cog):
|
|||
|
||||
def _get_cached_settings(self, guild_id):
|
||||
"""Récupère les paramètres avec cache (TTL de 5 secondes)"""
|
||||
now = discord.utils.utcnow().timestamp()
|
||||
now = disnake.utils.utcnow().timestamp()
|
||||
cached = self._settings_cache.get(guild_id)
|
||||
|
||||
if cached:
|
||||
|
|
@ -52,7 +52,7 @@ class AntiSpam(commands.Cog):
|
|||
|
||||
def _get_cached_whitelist(self, guild_id):
|
||||
"""Récupère la whitelist avec cache (TTL de 5 secondes)"""
|
||||
now = discord.utils.utcnow().timestamp()
|
||||
now = disnake.utils.utcnow().timestamp()
|
||||
cached = self._whitelist_cache.get(guild_id)
|
||||
|
||||
if cached:
|
||||
|
|
@ -117,7 +117,7 @@ class AntiSpam(commands.Cog):
|
|||
|
||||
# --- TEST ANTI-SPAM (deque pour O(1)) ---
|
||||
if settings.get("anti_spam") is True:
|
||||
now = discord.utils.utcnow().timestamp()
|
||||
now = disnake.utils.utcnow().timestamp()
|
||||
|
||||
# Initialiser ou récupérer le deque pour cet utilisateur
|
||||
if user_id not in self.message_counts:
|
||||
|
|
@ -156,7 +156,7 @@ class AntiSpam(commands.Cog):
|
|||
self.message_counts[user_id] = deque(maxlen=10)
|
||||
|
||||
if current_warns <= 3:
|
||||
embed = discord.Embed(
|
||||
embed = disnake.Embed(
|
||||
title="🛡️ Sécurité Kuby",
|
||||
description=f"{message.author.mention}, {reason}.\n**Avertissement : {current_warns}/3**",
|
||||
color=0xFFA500
|
||||
|
|
@ -169,10 +169,10 @@ class AntiSpam(commands.Cog):
|
|||
|
||||
async def apply_mute(self, message, reason):
|
||||
try:
|
||||
until = discord.utils.utcnow() + timedelta(minutes=5)
|
||||
until = disnake.utils.utcnow() + timedelta(minutes=5)
|
||||
await message.author.timeout(until, reason=f"Kuby Security: {reason} (3 Warns)")
|
||||
|
||||
embed = discord.Embed(
|
||||
embed = disnake.Embed(
|
||||
title="⛔ Exclusion Temporaire",
|
||||
description=f"**Membre :** {message.author.mention}\n**Durée :** 5 minutes\n**Raison :** {reason} répétitif.",
|
||||
color=0xFF0000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue