Skip to content

Commit

Permalink
Name more buttons and selects for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
yiays committed Oct 29, 2024
1 parent 1b5349f commit 478266a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions extensions/confessions_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def update_list(self):
) for channel,channeltype in self.matches[start:start+25]
]

@discord.ui.select()
@discord.ui.select(custom_id='channelselect_selector')
async def channel_selector(self, inter:discord.Interaction, this:discord.ui.Select):
""" Update the message to preview the selected target """
originuser = (self.origin.author if isinstance(self.origin,discord.Message) else self.origin.user)
Expand All @@ -263,7 +263,9 @@ async def channel_selector(self, inter:discord.Interaction, this:discord.ui.Sele
),
view=self)

@discord.ui.button(disabled=False, style=discord.ButtonStyle.primary, emoji='📨')
@discord.ui.button(
disabled=False, style=discord.ButtonStyle.primary, emoji='📨', custom_id='confessionchannel_send'
)
async def send_button(self, inter:discord.Interaction, _:discord.Button):
""" Send the confession """
if self.selection is None or self.done:
Expand Down
4 changes: 3 additions & 1 deletion extensions/confessions_moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ async def enable_button(self):
self.report_button.disabled = False
await self.origin.edit_original_response(view=self)

@discord.ui.button(disabled=True, style=discord.ButtonStyle.gray, emoji='➡️')
@discord.ui.button(
disabled=True, style=discord.ButtonStyle.gray, emoji='➡️', custom_id='confessionreport_confirm'
)
async def report_button(self, inter:discord.Interaction, _:discord.Button):
""" On click of continue button """
await inter.response.send_modal(
Expand Down
6 changes: 3 additions & 3 deletions extensions/confessions_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,18 @@ async def channel_selector_override(self, inter:discord.Interaction):
self.update_state()
await self.update_message(inter)

@discord.ui.button(emoji='❓', row=4)
@discord.ui.button(emoji='❓', row=4, custom_id='confessionsetup_help')
async def help(self, inter:discord.Interaction, _:discord.ui.Button):
self.update_state()
await self.update_message(inter)

@discord.ui.button(emoji='🟢', row=4)
@discord.ui.button(emoji='🟢', row=4, custom_id='confessionsetup_anonid')
async def toggle_anon_ids(self, inter:discord.Interaction, _:discord.ui.Button):
if self.current_mode.swap:
self.current_mode = self.current_mode.swap
await self.set(inter, self.current_channel, self.current_mode)

@discord.ui.select()
@discord.ui.select(custom_id='confessionsetup_mode')
async def mode_selector(self, inter:discord.Interaction, this:discord.ui.Select):
if inter.user != self.origin.user:
await inter.response.send_message(self.parent.bot.babel(inter, 'error', 'wronguser'))
Expand Down

0 comments on commit 478266a

Please sign in to comment.