|
|
@@ -2,12 +2,54 @@ from discord.ext import commands
|
|
|
import discord
|
|
|
import time
|
|
|
from typing import Optional
|
|
|
-from query.channel import get_interact
|
|
|
+from query.channel import get_interact, set_interact, set_games
|
|
|
from query.user import ignore_user, unignore_user, is_ignored
|
|
|
from common.logging import report
|
|
|
from common.settings import check_ignore
|
|
|
|
|
|
|
|
|
+class MyView(discord.ui.View):
|
|
|
+ #@discord.ui.button(label="Duplicate the current settings to all channels", row=0, style=discord.ButtonStyle.primary)
|
|
|
+ #async def first_button_callback(self, button, interaction):
|
|
|
+ # await interaction.response.send_message("You pressed me!")
|
|
|
+
|
|
|
+ #@discord.ui.button(label="Reset all settings to default", row=0, style=discord.ButtonStyle.primary)
|
|
|
+ #async def second_button_callback(self, button, interaction):
|
|
|
+ # await interaction.response.send_message("You pressed me!")
|
|
|
+
|
|
|
+ @discord.ui.select(
|
|
|
+ row=0,
|
|
|
+ options=[
|
|
|
+ discord.SelectOption(
|
|
|
+ label="Interact",
|
|
|
+ description="Have me interact in the chat."
|
|
|
+ ),
|
|
|
+ discord.SelectOption(
|
|
|
+ label="Ignore",
|
|
|
+ description="Do not mingle in the chat."
|
|
|
+ ),
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ async def first_select_callback(self, select, interaction):
|
|
|
+ await set_interact(self.bot.pg, select.values[0], interaction.channel.id)
|
|
|
+
|
|
|
+ @discord.ui.select(
|
|
|
+ row=1,
|
|
|
+ options=[
|
|
|
+ discord.SelectOption(
|
|
|
+ label="Games",
|
|
|
+ description="Activate discord games like ActiveRPG."
|
|
|
+ ),
|
|
|
+ discord.SelectOption(
|
|
|
+ label="Serious",
|
|
|
+ description="No fun commands."
|
|
|
+ ),
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ async def second_select_callback(self, select, interaction):
|
|
|
+ await interaction.response.send_message(f"Awesome! I like {select.values[0]} too!")
|
|
|
+
|
|
|
+
|
|
|
class ChannelSettingsModal(discord.ui.Modal):
|
|
|
def __init__(self, *args, **kwargs) -> None:
|
|
|
super().__init__(*args, **kwargs)
|
|
|
@@ -27,6 +69,10 @@ class Admin(commands.Cog):
|
|
|
def __init__(self, bot): # Special method that is called when the cog is loaded
|
|
|
self.bot = bot
|
|
|
|
|
|
+ @commands.slash_command()
|
|
|
+ async def flavor(self, ctx):
|
|
|
+ await ctx.respond("Adjust channel settings.", view=MyView())
|
|
|
+
|
|
|
@commands.slash_command()
|
|
|
async def modal_slash(self, ctx: discord.ApplicationContext):
|
|
|
"""Shows an example of a modal dialog being invoked from a slash command."""
|