Skip to content

Commit

Permalink
Ignore empty spoilers
Browse files Browse the repository at this point in the history
  • Loading branch information
greeeen-dev committed Feb 15, 2025
1 parent 1441548 commit 0cff832
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions revolt_bridge_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ async def make_friendly(self, text):

# Convert spoilers to Discord format
components = text.split('!!')
for component in components:
if len(component) == 0:
components.remove(component)

to_replace = (len(components) - 1) - ((len(components) - 1) % 2)
text = text.replace('!!', '||', to_replace)

Expand Down Expand Up @@ -445,6 +449,10 @@ def to_color(color):

# Convert spoilers to Revolt format
components = content.split('||')
for component in components:
if len(component) == 0:
components.remove(component)

to_replace = (len(components) - 1) - ((len(components) - 1) % 2)
content = content.replace('||', '!!', to_replace)

Expand Down

0 comments on commit 0cff832

Please sign in to comment.