Skip to content

Commit

Permalink
Updated TFee Data to v9
Browse files Browse the repository at this point in the history
  • Loading branch information
dorythecat committed Jun 20, 2024
1 parent a4d8db8 commit 71a11ab
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

# DATA VERSIONS
# REMEMBER TO REGENERATE ALL TRANSFORMATION DATA IF YOU CHANGE THE VERSION
# VERSION 9: Added "blocked_users" field
# VERSION 8: Added "upside_down" and "backwards" fields
# VERSION 7: Added "bio" field
# VERSION 6: Added "blocked_channels" field
Expand All @@ -17,7 +18,7 @@
# VERSION 3: Added "big", "small", and "hush" fields, and changed "eternal" from bool to int
# VERSION 2: Added guild specific data
# VERSION 1: Base version
CURRENT_TFEE_DATA_VERSION = 8
CURRENT_TFEE_DATA_VERSION = 9

# VERSION 4: Each user now stores the channels they're transformed on
# VERSION 3: Added "blocked_users" field
Expand All @@ -40,6 +41,7 @@ def write_tf(user: discord.User,
guild: discord.Guild,
channel: discord.TextChannel = None,
block_channel: discord.TextChannel = None,
block_user: discord.User = None,
transformed_by: str = None,
into: str = None,
image_url: str = None,
Expand Down Expand Up @@ -69,6 +71,7 @@ def write_tf(user: discord.User,
data[str(guild.id)] = {}
if channel_id not in data[str(guild.id)]:
data[str(guild.id)]['blocked_channels'] = []
data[str(guild.id)]['blocked_users'] = []
data[str(guild.id)][channel_id] = {
'transformed_by': transformed_by,
'into': into,
Expand Down Expand Up @@ -123,6 +126,11 @@ def write_tf(user: discord.User,
data[str(guild.id)]['blocked_channels'].append(str(block_channel.id))
else:
data[str(guild.id)]['blocked_channels'].remove(str(block_channel.id))
if block_user is not None:
if str(block_user.id) not in data[str(guild.id)]['blocked_users']:
data[str(guild.id)]['blocked_users'].append(str(block_user.id))
else:
data[str(guild.id)]['blocked_users'].remove(str(block_user.id))
if prefix is not None:
data[str(guild.id)][channel_id]['prefix']['active'] = True if prefix != "" else False
data[str(guild.id)][channel_id]['prefix']['contents'] += [prefix.strip()] if prefix != "" else []
Expand Down

0 comments on commit 71a11ab

Please sign in to comment.