Skip to content

Commit

Permalink
Further improve anon-ids in vetting channels
Browse files Browse the repository at this point in the history
  • Loading branch information
yiays committed Oct 20, 2024
1 parent 97be0ff commit a8619e7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions extensions/confessions_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,14 +733,13 @@ async def send_confession(
if use_webhook:
if webhook := await self.find_or_create_webhook(channel):
botcolour = self.bot.config['main']['themecolor'][2:]
show_anonid = self.anonid and self.channeltype.anonid
username = (
(preface + ' - ' if preface else '') +
(f'[Anon-{self.anonid}]' if show_anonid else '[Anon]')
(f'[Anon-{self.anonid}]' if self.channeltype.anonid else '[Anon]')
)
pfp = (
self.config.get('pfpgen_url', '')
.replace('{}', botcolour if show_anonid else self.anonid)
.replace('{}', self.anonid if self.channeltype.anonid else botcolour)
)
func = webhook.send(self.content, username=username, avatar_url=pfp, **kwargs)
#TODO: add support for custom PFPs
Expand All @@ -751,6 +750,13 @@ async def send_confession(
func = channel.send(preface, embed=self.embed, **kwargs)
success = await self.handle_send_errors(inter, func)

if 'Log' in self.bot.cogs and channel == self.targetchannel:
logentry = (
f'{inter.guild.name}/{self.anonid}: {self.bot.utilities.truncate(self.content)}' +
(' (attachment)' if self.file else '')
)
await self.bot.cogs['Log'].log_misc_str(content=logentry)

# Mark the command as complete by sending a success message
if success and success_message:
if inter.channel != self.targetchannel: # confess-to
Expand Down

0 comments on commit a8619e7

Please sign in to comment.