Data API Complicance (Red 3.4) (#136)

* Simple ones first

* Less simple but still simple.

* Slightly more complicated

* use correct name

* move to module

* Black -l 120

* review

* give users the proper feedback

Co-authored-by: aikaterna <20862007+aikaterna@users.noreply.github.com>
This commit is contained in:
Draper
2020-08-26 17:57:43 +01:00
committed by GitHub
parent 4376194429
commit ae9dbf569c
95 changed files with 593 additions and 703 deletions

View File

@@ -1,5 +1,9 @@
from .otherbot import Otherbot
__red_end_user_data_statement__ = (
"This cog does not persistently store end user data. " "This cog does store discord IDs as needed for operation. "
)
async def setup(bot):
cog = Otherbot(bot)

View File

@@ -1,9 +1,16 @@
{
"author": ["aikaterna", "Predä 。#1001"],
"description": "Alerts a role when bot(s) go offline.",
"install_msg": "Thanks for installing, have fun.",
"permissions": ["manage_roles"],
"short": "Alerts a role when bot(s) go offline.",
"tags": ["bots"],
"type": "COG"
"author": [
"aikaterna", "Predä 。#1001"
],
"description": "Alerts a role when bot(s) go offline.",
"install_msg": "Thanks for installing, have fun.",
"permissions" : [
"manage_roles"
],
"short": "Alerts a role when bot(s) go offline.",
"tags": [
"bots"
],
"type": "COG",
"end_user_data_statement": "This cog does not persistently store end user data. This cog does store discord IDs as needed for operation. "
}

View File

@@ -1,3 +1,5 @@
from typing import Literal
import discord
from redbot.core.bot import Red
from redbot.core import commands, checks, Config
@@ -10,7 +12,21 @@ DEFAULT_ONLINE_EMOJI = "\N{WHITE HEAVY CHECK MARK}"
class Otherbot(commands.Cog):
__author__ = ["aikaterna", "Predä 。#1001"]
__version__ = "0.9"
__version__ = "0.10"
async def red_delete_data_for_user(
self, *, requester: Literal["discord", "owner", "user", "user_strict"], user_id: int,
):
if requester == "discord":
# user is deleted, just comply
data = await self.config.all_guilds()
for guild_id, guild_data in data.items():
if user_id in guild_data.get("watching", []):
bypass = guild_data.get("watching", [])
bypass = set(bypass)
bypass.discard(user_id)
await self.config.guild_from_id(guild_id).bypass.set(list(bypass))
def __init__(self, bot: Red):
self.bot = bot