Skip to content

Commit

Permalink
Testing out channel select ui element
Browse files Browse the repository at this point in the history
  • Loading branch information
DMcP89 committed May 16, 2024
1 parent 3b57a92 commit 079c638
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
8 changes: 2 additions & 6 deletions harambot/cogs/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import discord
import logging

from harambot.ui.views import ConfigView
from harambot.ui.views import ConfigView, ReportConfigView

logger = logging.getLogger("discord.harambot.cogs.meta")
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -105,11 +105,7 @@ def webhook_permissions(interaction: discord.Interaction):
@app_commands.check(webhook_permissions)
async def reports(self, interaction: discord.Interaction):
await interaction.response.send_message(
"""
Configure automatic reports
1. Configure transaction reports
2. Configure matchup reports
"""
view=ReportConfigView(), ephemeral=True
)

@reports.error
Expand Down
17 changes: 17 additions & 0 deletions harambot/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,20 @@ def __init__(
self.add_item(YahooAuthButton())
self.add_item(ConfigGuildButton(parent_view=self))
self.add_item(ResetButton())


class ReportConfigView(discord.ui.View):
def __init__(self):
super().__init__()

@discord.ui.select(
cls=discord.ui.ChannelSelect, channel_types=[discord.ChannelType.text]
)
async def select_channels(
self,
interaction: discord.Interaction,
select: discord.ui.ChannelSelect,
):
return await interaction.response.send_message(
f"You selected {select.values[0].mention}"
)

0 comments on commit 079c638

Please sign in to comment.