Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 28, 2023
1 parent d88c40a commit e0215af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
8 changes: 8 additions & 0 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ async def ad_btn_callback(interaction):
class Inquiry(Cog):
def __init__(self, bot: Bot) -> None:
self.bot = bot
self.persistent_modal_added = False

@Cog.listener()
async def on_ready(self):
if not self.persistent_modal_added:
self.bot.add_modal(AdForm())
self.bot.add_modal(QuestionForm())
self.persistent_modal_added = True

@slash_command(name="deploy", description="Send inquiry embed")
async def deploy(self, ctx) -> None:
Expand Down
25 changes: 6 additions & 19 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import nextcord
from nextcord.ext import commands
from nextcord.ext.commands import Bot
from dotenv import load_dotenv

from cogs.inquiry import AdForm, QuestionForm

load_dotenv()

TOKEN = os.getenv("BOT")
Expand All @@ -14,27 +12,16 @@
intents.message_content = True

print("[System] Beginning load...")


class Bot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.persistent_modals_added = False

async def on_ready(self):
if not self.persistent_modals_added:
self.add_modal(AdForm())
self.add_modal(QuestionForm())
self.persistent_modals_added = True

print(f"[System] Logged in as {bot.user.name}.")


bot = Bot(command_prefix="!", intents=intents)
bot.load_extension("cogs.inquiry")
bot.load_extension("cogs.ticket")


@bot.event
async def on_ready():
print(f"[System] Logged in as {bot.user.name}.")


if not TOKEN:
print("[System] Missing TOKEN environment variable.")

Expand Down

0 comments on commit e0215af

Please sign in to comment.