Add red_delete_data_for_user
This commit is contained in:
parent
ea71aafb52
commit
36dc74cfb1
@ -38,6 +38,10 @@ class AnnounceDaily(Cog):
|
||||
self.config.register_global(**default_global)
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
async def _get_msgs(self):
|
||||
return DEFAULT_MESSAGES + await self.config.messages()
|
||||
|
||||
|
@ -22,6 +22,10 @@ class CCRole(commands.Cog):
|
||||
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.group()
|
||||
async def ccrole(self, ctx: commands.Context):
|
||||
|
@ -2,6 +2,7 @@ import asyncio
|
||||
import os
|
||||
import pathlib
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Literal
|
||||
|
||||
import discord
|
||||
from chatterbot import ChatBot
|
||||
@ -11,6 +12,7 @@ from chatterbot.trainers import ChatterBotCorpusTrainer, ListTrainer
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.commands import Cog
|
||||
from redbot.core.data_manager import cog_data_path
|
||||
from redbot.core.utils import AsyncIter
|
||||
|
||||
|
||||
class ENG_LG: # TODO: Add option to use this large model
|
||||
@ -49,8 +51,12 @@ class Chatter(Cog):
|
||||
|
||||
self.loop = asyncio.get_event_loop()
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
def _create_chatbot(
|
||||
self, data_path, similarity_algorithm, similarity_threshold, tagger_language
|
||||
self, data_path, similarity_algorithm, similarity_threshold, tagger_language
|
||||
):
|
||||
return ChatBot(
|
||||
"ChatterBot",
|
||||
@ -99,7 +105,7 @@ class Chatter(Cog):
|
||||
try:
|
||||
|
||||
async for message in channel.history(
|
||||
limit=None, after=after, oldest_first=True
|
||||
limit=None, after=after, oldest_first=True
|
||||
).filter(
|
||||
predicate=predicate
|
||||
): # type: discord.Message
|
||||
@ -182,7 +188,9 @@ class Chatter(Cog):
|
||||
try:
|
||||
os.remove(self.data_path)
|
||||
except PermissionError:
|
||||
await ctx.maybe_send_embed("Failed to clear training database. Please wait a bit and try again")
|
||||
await ctx.maybe_send_embed(
|
||||
"Failed to clear training database. Please wait a bit and try again"
|
||||
)
|
||||
|
||||
self._create_chatbot(self.data_path, SpacySimilarity, 0.45, ENG_MD)
|
||||
|
||||
|
@ -28,6 +28,10 @@ class CogLint(Cog):
|
||||
self.config.register_global(**default_global)
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
async def autolint(self, ctx: commands.Context):
|
||||
"""Toggles automatically linting code"""
|
||||
|
@ -32,6 +32,10 @@ class Dad(Cog):
|
||||
|
||||
self.cooldown = defaultdict(datetime.now)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
async def dadjoke(self, ctx: commands.Context):
|
||||
headers = {
|
||||
|
@ -18,6 +18,10 @@ class ExclusiveRole(Cog):
|
||||
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.group(aliases=["exclusiverole"])
|
||||
async def exclusive(self, ctx):
|
||||
|
17
flag/flag.py
17
flag/flag.py
@ -1,9 +1,11 @@
|
||||
from datetime import date, timedelta
|
||||
from typing import Literal
|
||||
|
||||
import discord
|
||||
from redbot.core import Config, checks, commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.commands import Cog
|
||||
from redbot.core.utils import AsyncIter
|
||||
from redbot.core.utils.chat_formatting import pagify
|
||||
|
||||
|
||||
@ -22,6 +24,21 @@ class Flag(Cog):
|
||||
self.config.register_global(**default_global)
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(
|
||||
self,
|
||||
*,
|
||||
requester: Literal["discord_deleted_user", "owner", "user", "user_strict"],
|
||||
user_id: int,
|
||||
):
|
||||
if requester not in ["discord_deleted_user", "owner"]:
|
||||
return
|
||||
|
||||
all_members = await self.config.all_members()
|
||||
|
||||
async for guild_id, guild_data in AsyncIter(all_members.items(), steps=100):
|
||||
if user_id in guild_data:
|
||||
await self.config.member_from_ids(guild_id, user_id).clear()
|
||||
|
||||
@checks.is_owner()
|
||||
@commands.guild_only()
|
||||
@commands.command()
|
||||
|
@ -21,6 +21,10 @@ class ForceMention(Cog):
|
||||
self.config.register_global(**default_global)
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@checks.admin_or_permissions(manage_roles=True)
|
||||
@commands.command()
|
||||
async def forcemention(self, ctx: commands.Context, role: str, *, message=""):
|
||||
|
@ -14,6 +14,7 @@ class Hangman(Cog):
|
||||
letters = "🇦🇧🇨🇩🇪🇫🇬🇭🇮🇯🇰🇱🇲🇳🇴🇵🇶🇷🇸🇹🇺🇻🇼🇽🇾🇿"
|
||||
|
||||
def __init__(self, bot):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
self.config = Config.get_conf(self, identifier=1049711010310997110)
|
||||
default_guild = {"theface": ":thinking:", "emojis": True}
|
||||
@ -39,6 +40,10 @@ class Hangman(Cog):
|
||||
|
||||
self.hanglist = {}
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
async def _update_hanglist(self):
|
||||
for guild in self.bot.guilds:
|
||||
theface = await self.config.guild(guild).theface()
|
||||
|
@ -41,6 +41,10 @@ class InfoChannel(Cog):
|
||||
|
||||
self._critical_section_wooah_ = 0
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
@checks.admin()
|
||||
async def infochannel(self, ctx: commands.Context):
|
||||
|
@ -10,12 +10,17 @@ class Leaver(Cog):
|
||||
"""
|
||||
|
||||
def __init__(self, bot: Red):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
self.config = Config.get_conf(self, identifier=9811198108111121, force_registration=True)
|
||||
default_guild = {"channel": ""}
|
||||
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.group(aliases=["setleaver"])
|
||||
@checks.mod_or_permissions(administrator=True)
|
||||
async def leaverset(self, ctx):
|
||||
|
@ -9,8 +9,13 @@ class LoveCalculator(Cog):
|
||||
"""Calculate the love percentage for two users!"""
|
||||
|
||||
def __init__(self, bot):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command(aliases=["lovecalc"])
|
||||
async def lovecalculator(
|
||||
self, ctx: commands.Context, lover: discord.Member, loved: discord.Member
|
||||
|
@ -1,10 +1,12 @@
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
import dateutil.parser
|
||||
import discord
|
||||
from redbot.core import Config, commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.commands import Cog
|
||||
from redbot.core.utils import AsyncIter
|
||||
|
||||
|
||||
class LastSeen(Cog):
|
||||
@ -28,6 +30,19 @@ class LastSeen(Cog):
|
||||
self.config.register_guild(**default_guild)
|
||||
self.config.register_member(**default_member)
|
||||
|
||||
async def red_delete_data_for_user(
|
||||
self,
|
||||
*,
|
||||
requester: Literal["discord_deleted_user", "owner", "user", "user_strict"],
|
||||
user_id: int,
|
||||
):
|
||||
|
||||
all_members = await self.config.all_members()
|
||||
|
||||
async for guild_id, guild_data in AsyncIter(all_members.items(), steps=100):
|
||||
if user_id in guild_data:
|
||||
await self.config.member_from_ids(guild_id, user_id).clear()
|
||||
|
||||
@staticmethod
|
||||
def get_date_time(s):
|
||||
d = dateutil.parser.parse(s)
|
||||
|
@ -5,18 +5,19 @@ import datetime
|
||||
import json
|
||||
import time
|
||||
from random import choice
|
||||
from typing import Literal
|
||||
|
||||
import discord
|
||||
from redbot.core import Config, bank, commands
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.data_manager import bundled_data_path
|
||||
from redbot.core.utils import AsyncIter
|
||||
|
||||
|
||||
class Gardener(commands.Cog):
|
||||
class Gardener:
|
||||
"""Gardener class"""
|
||||
|
||||
def __init__(self, user: discord.User, config: Config):
|
||||
super().__init__()
|
||||
self.user = user
|
||||
self.config = config
|
||||
self.badges = []
|
||||
@ -180,7 +181,17 @@ class PlantTycoon(commands.Cog):
|
||||
|
||||
# self.bank = bot.get_cog('Economy').bank
|
||||
|
||||
async def red_delete_data_for_user(
|
||||
self,
|
||||
*,
|
||||
requester: Literal["discord_deleted_user", "owner", "user", "user_strict"],
|
||||
user_id: int,
|
||||
):
|
||||
|
||||
await self.config.user_from_id(user_id).clear()
|
||||
|
||||
async def _load_plants_products(self):
|
||||
"""Runs in __init__.py before cog is added to the bot"""
|
||||
plant_path = bundled_data_path(self) / "plants.json"
|
||||
product_path = bundled_data_path(self) / "products.json"
|
||||
with plant_path.open() as json_data:
|
||||
|
@ -25,6 +25,10 @@ class QRInvite(Cog):
|
||||
self.config.register_global(**default_global)
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
async def qrinvite(
|
||||
self,
|
||||
|
@ -35,6 +35,10 @@ class ReactRestrict(Cog):
|
||||
)
|
||||
self.config.register_global(registered_combos=[])
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
async def combo_list(self) -> List[ReactRestrictCombo]:
|
||||
"""
|
||||
Returns a list of reactrestrict combos.
|
||||
|
@ -15,6 +15,10 @@ class RecyclingPlant(Cog):
|
||||
self.bot = bot
|
||||
self.junk = None
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
def load_junk(self):
|
||||
junk_path = bundled_data_path(self) / "junk.json"
|
||||
with junk_path.open() as json_data:
|
||||
|
@ -21,6 +21,10 @@ class RPSLS(Cog):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
async def rpsls(self, ctx: commands.Context, choice: str):
|
||||
"""
|
||||
|
@ -27,6 +27,10 @@ class SayUrl(Cog):
|
||||
self.config.register_global(**default_global)
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
async def sayurl(self, ctx: commands.Context, url):
|
||||
"""
|
||||
|
@ -11,6 +11,10 @@ class SCP(Cog):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command()
|
||||
async def scp(self, ctx: commands.Context, num: int):
|
||||
"""Look up SCP articles.
|
||||
|
@ -48,6 +48,10 @@ class StealEmoji(Cog):
|
||||
|
||||
self.is_on = None
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.group()
|
||||
async def stealemoji(self, ctx: commands.Context):
|
||||
"""
|
||||
|
@ -22,6 +22,10 @@ class Timerole(Cog):
|
||||
self.config.register_guild(**default_guild)
|
||||
self.updating = self.bot.loop.create_task(self.check_day())
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
def cog_unload(self):
|
||||
self.updating.cancel()
|
||||
|
||||
|
@ -23,6 +23,10 @@ class TTS(Cog):
|
||||
self.config.register_global(**default_global)
|
||||
self.config.register_guild(**default_guild)
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.command(aliases=["t2s", "text2"])
|
||||
async def tts(self, ctx: commands.Context, *, text: str):
|
||||
"""
|
||||
|
@ -12,6 +12,10 @@ class Unicode(Cog):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
@commands.group(name="unicode", pass_context=True)
|
||||
async def unicode(self, ctx):
|
||||
"""Encode/Decode a Unicode character."""
|
||||
|
@ -20,6 +20,7 @@ class Werewolf(Cog):
|
||||
"""
|
||||
|
||||
def __init__(self, bot: Red):
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
self.config = Config.get_conf(
|
||||
self, identifier=87101114101119111108102, force_registration=True
|
||||
@ -37,6 +38,10 @@ class Werewolf(Cog):
|
||||
|
||||
self.games = {} # Active games stored here, id is per guild
|
||||
|
||||
async def red_delete_data_for_user(self, **kwargs):
|
||||
"""Nothing to delete"""
|
||||
return
|
||||
|
||||
def __unload(self):
|
||||
print("Unload called")
|
||||
for game in self.games.values():
|
||||
|
Loading…
x
Reference in New Issue
Block a user