diff --git a/.gitignore b/.gitignore index d6e1b3c..92261ca 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,5 @@ cython_debug/ marlow-bot/ + +config.json diff --git a/cogs/inquiry.py b/cogs/inquiry.py index 5b6aa36..2d045fe 100644 --- a/cogs/inquiry.py +++ b/cogs/inquiry.py @@ -2,7 +2,7 @@ from nextcord.ext.commands import Bot, Cog import nextcord -EMBED_COLOR = 0xff88ff +EMBED_COLOR = 0xFF88FF class QuestionForm(nextcord.ui.Modal): @@ -24,13 +24,10 @@ def __init__(self): async def callback(self, interaction: nextcord.Interaction) -> None: response = "Placeholder." if self.details.value != "": - response += ( - "response" - ) + response += "response" await interaction.send(response) - class Inquiry(Cog): def __init__(self, bot: Bot) -> None: self.bot = bot @@ -52,12 +49,15 @@ async def deploy(self, ctx) -> None: async def btn_callback(interaction): await interaction.response.send_modal(QuestionForm()) - btn = nextcord.ui.Button(label="📝 Open Inquiry", style=nextcord.ButtonStyle.blurple) + btn = nextcord.ui.Button( + label="📝 Open Inquiry", style=nextcord.ButtonStyle.blurple + ) btn.callback = btn_callback view = nextcord.ui.View() view.add_item(btn) await ctx.channel.send(embed=em, view=view) + def setup(bot: Bot) -> None: bot.add_cog(Inquiry(bot)) diff --git a/cogs/ticket.py b/cogs/ticket.py index e69de29..4c69e88 100644 --- a/cogs/ticket.py +++ b/cogs/ticket.py @@ -0,0 +1,31 @@ +from nextcord import SlashOption, TextChannel, slash_command +from nextcord.ext.commands import Bot, Cog +import nextcord +import json + +with open("config.json", "r") as config_file: + config = json.load(config_file) + + +class Ticket(Cog): + def __init__(self, bot: Bot) -> None: + self.bot = bot + + @slash_command(name="config", description="set bot config") + async def set_log_channel( + self, + inter: nextcord.Interaction, + channel: TextChannel = SlashOption( + description="channel to recieve requests", + required=True, + ), + ): + config["request_channel"] = channel.id + with open("config.json", "w") as config_file: + json.dump(config, config_file, indent=4) + + await inter.send(f"Request channel set to <#{channel.id}>.", ephemeral=True) + + +def setup(bot: Bot) -> None: + bot.add_cog(Ticket(bot)) diff --git a/main.py b/main.py index c4ca080..9d461df 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ load_dotenv() TOKEN = os.getenv("BOT") -EMBED_COLOR = 0xfffe88ff +EMBED_COLOR = 0xFFFE88FF intents = nextcord.Intents.default() intents.message_content = True @@ -14,6 +14,8 @@ print("[System] Beginning load...") bot = Bot(command_prefix="!", intents=intents) bot.load_extension("cogs.inquiry") +bot.load_extension("cogs.ticket") + @bot.event async def on_ready():