fix(ranks): Fix notification logic.

This commit is contained in:
2023-10-29 03:31:36 +02:00
parent d1b9a95bd2
commit ec0463f0e7

View File

@@ -592,20 +592,25 @@ class RankCog(LionCog):
# Calculate destination # Calculate destination
to_dm = lguild.config.get('dm_ranks').value to_dm = lguild.config.get('dm_ranks').value
rank_channel = lguild.config.get('rank_channel').value rank_channel = lguild.config.get('rank_channel').value
sent = False
if to_dm or not rank_channel: if to_dm:
destination = member destination = member
embed.set_author( embed.set_author(
name=guild.name, name=guild.name,
icon_url=guild.icon.url if guild.icon else None icon_url=guild.icon.url if guild.icon else None
) )
text = None try:
else: await destination.send(embed=embed)
sent = True
except discord.HTTPException:
if not rank_channel:
raise
if not sent and rank_channel:
destination = rank_channel destination = rank_channel
text = member.mention text = member.mention
await destination.send(content=text, embed=embed)
# Post!
await destination.send(embed=embed, content=text)
def get_message_map(self, def get_message_map(self,
rank_type: RankType, rank_type: RankType,