Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
greeeen-dev committed Sep 29, 2024
1 parent 105ea39 commit e1a0725
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
27 changes: 19 additions & 8 deletions cogs/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,12 @@ async def make_friendly(self, text, server=None, image_markdown=False):
while offset < len(components):
if len(components) == 1 and offset == 0:
break
emojiname = components[offset].split(':', 1)[0]
emojiafter = components[offset].split(':', 1)[1].split('>')[0]+'>'
text = text.replace(f'<:{emojiname}:{emojiafter}', f':{emojiname}\\:')
try:
emojiname = components[offset].split(':', 1)[0]
emojiafter = components[offset].split(':', 1)[1].split('>')[0]+'>'
text = text.replace(f'<:{emojiname}:{emojiafter}', f':{emojiname}\\:')
except:
pass
offset += 1

components = text.split('<a:')
Expand All @@ -1306,10 +1309,13 @@ async def edit(self, message, content):

threads = []

server = self.__bot.get_guild(int(msg.guild_id))

source_support = self.__bot.platforms[msg.source] if msg.source != 'discord' else None

if msg.source == 'discord':
server = self.__bot.get_guild(int(msg.guild_id))
else:
server = source_support.get_server(msg.guild_id)

async def edit_discord(msgs,friendly=False):
threads = []

Expand Down Expand Up @@ -2391,9 +2397,14 @@ async def tbsend(msg_author,url,color,useremoji,reply,content, files, destguild)
special.update({'reply': reply})
if trimmed:
special.update({'reply_content': trimmed})
msg = await dest_support.send(
ch, content_override if can_override else (content + stickertext), special=special
)
try:
msg = await dest_support.send(
ch, content_override if can_override else (content + stickertext), special=special
)
except Exception as e:
if type(e) in dest_support.api_unavoidable_exceptions:
return None
raise
tbresult = [
{f'{guild_id}': [
dest_support.get_id(dest_support.channel(msg)), dest_support.get_id(msg)
Expand Down
5 changes: 1 addition & 4 deletions cogs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,7 @@ def search_filter(query, query_cmd):
)
index = 0
text = ''
if roomname in list(self.bot.db['rules'].keys()):
rules = self.bot.db['rules'][roomname]
else:
rules = []
rules = self.bot.db['rooms'][roomname]['meta']['rules']
for rule in rules:
if text == '':
text = f'1. {rule}'
Expand Down

0 comments on commit e1a0725

Please sign in to comment.