Fixed the consent so now it requires it all the time
This commit is contained in:
@@ -22,17 +22,12 @@ class ConsentView(View):
|
||||
await interaction.response.edit_message(content="You have declined data storage. You cannot use this bot without consenting.", view=None)
|
||||
self.stop()
|
||||
|
||||
|
||||
async def check_user_consent(user_id):
|
||||
"""Check if the user has given consent to data storage, default to True."""
|
||||
"""Check if the user has given consent to data storage. Assume no consent if no record exists."""
|
||||
async with aiosqlite.connect(DATABASE) as db:
|
||||
cursor = await db.execute("SELECT consent_given FROM user_consents WHERE user_id = ?", (user_id,))
|
||||
result = await cursor.fetchone()
|
||||
if result is None:
|
||||
# Assume consent given if no record exists
|
||||
return True
|
||||
return result[0]
|
||||
|
||||
return result[0] if result else False # Return False if no record exists, prompting consent dialogue
|
||||
|
||||
async def store_user_consent(user_id):
|
||||
"""Store the user's consent to data storage."""
|
||||
|
Reference in New Issue
Block a user