REF: Final update to make sure the code is GDPR compliant
This commit is contained in:
parent
d82d1e0729
commit
6009c82ce9
@ -2,6 +2,7 @@ import discord
|
|||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import aiosqlite
|
import aiosqlite
|
||||||
|
import json
|
||||||
from gdpr import check_consent, give_consent, revoke_consent
|
from gdpr import check_consent, give_consent, revoke_consent
|
||||||
|
|
||||||
|
|
||||||
@ -37,8 +38,7 @@ class GDPRCommands(commands.Cog):
|
|||||||
"Data is stored securely and only accessible by authorized "
|
"Data is stored securely and only accessible by authorized "
|
||||||
"personnel.\n"
|
"personnel.\n"
|
||||||
"You can revoke consent at any time by using the /revoke_consent "
|
"You can revoke consent at any time by using the /revoke_consent "
|
||||||
"command.\n"
|
"command."
|
||||||
"For more details, visit our [website](https://example.com/privacy)." # noqa: E501
|
|
||||||
)
|
)
|
||||||
await interaction.response.send_message(privacy_text)
|
await interaction.response.send_message(privacy_text)
|
||||||
|
|
||||||
@ -54,13 +54,20 @@ class GDPRCommands(commands.Cog):
|
|||||||
row = await cursor.fetchone()
|
row = await cursor.fetchone()
|
||||||
if row:
|
if row:
|
||||||
notes, strikes = row
|
notes, strikes = row
|
||||||
data_text = f"Your data:\nNotes: {notes}\nStrikes: {strikes}"
|
data = {
|
||||||
await interaction.user.send(data_text)
|
"user_id": user_id,
|
||||||
|
"notes": notes,
|
||||||
|
"strikes": strikes
|
||||||
|
}
|
||||||
|
data_text = json.dumps(data, indent=4)
|
||||||
|
await interaction.user.send
|
||||||
|
(f"Your data:\n```json\n{data_text}\n```")
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
"Your data has been sent to you privately."
|
"Your data has been sent to you privately."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await interaction.response.send_message("No data found for you.") # noqa: E501
|
await interaction.response.send_message
|
||||||
|
("No data found for you.")
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
|
4
main.py
4
main.py
@ -9,8 +9,8 @@ from dotenv import load_dotenv
|
|||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
GUILD_ID = os.getenv('GUILD_ID')
|
||||||
TOKEN = os.getenv('DISCORD_TOKEN')
|
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||||
GUILD_ID = int(os.getenv('GUILD_ID'))
|
|
||||||
|
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.message_content = True
|
intents.message_content = True
|
||||||
@ -25,7 +25,7 @@ class Ariella(commands.Bot):
|
|||||||
await self.load_extension('commands')
|
await self.load_extension('commands')
|
||||||
await self.load_extension('gdpr_commands')
|
await self.load_extension('gdpr_commands')
|
||||||
self.tree.copy_global_to(guild=discord.Object(id=GUILD_ID))
|
self.tree.copy_global_to(guild=discord.Object(id=GUILD_ID))
|
||||||
await self.tree.sync(guild=discord.Object(id=GUILD_ID))
|
await self.tree.sync()
|
||||||
|
|
||||||
|
|
||||||
bot = Ariella()
|
bot = Ariella()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user