Skip to content

Commit

Permalink
bot stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 26, 2023
1 parent 4737e71 commit 5479921
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 16 deletions.
65 changes: 65 additions & 0 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from nextcord import Interaction, slash_command
from nextcord.ext.commands import Bot, Cog
import nextcord
from nextcord.types.components import ButtonStyle
from nextcord.ui import modal

EMBED_COLOR = 0xff88ff


class QuestionForm(nextcord.ui.Modal):
def __init__(self):
super().__init__(
"Contact Marlow",
timeout=5 * 60, # 5 minutes
)

self.details = nextcord.ui.TextInput(
label="Inquiry details",
style=nextcord.TextInputStyle.paragraph,
placeholder="Contact Reason",
required=True,
max_length=1800,
)
self.add_item(self.details)

async def callback(self, interaction: nextcord.Interaction) -> None:
response = f"Placeholder."
if self.details.value != "":
response += (
f"\nTheir pet can be recognized by this information:\n{self.details.value}"
)
await interaction.send(response)

class InquiryButton(nextcord.ui.Button):
def __init__(self):
super().__init__(
label="📝 Open Inquiry",
custom_id="open_inquiry",
style=nextcord.ButtonStyle.primary
)

class Inquiry(Cog):
def __init__(self, bot: Bot) -> None:
self.bot = bot

@slash_command(name="deploy", description="Send inquiry embed")
async def deploy(self, ctx) -> None:
if isinstance(ctx.channel, nextcord.TextChannel):
em = nextcord.Embed(
title="📫 Contact Request",
description="""
Due to an influx of messages, I have decided to use requests to filter spam while still providing a means for important inquiries to be made.
I cannot guarantee a response to each inquiry.
Please reserve this system for important reasons.
""",
color=EMBED_COLOR,
)
button = InquiryButton()
view = nextcord.ui.View()
view.add_item(button)
await ctx.channel.send(embed=em, view=view)

def setup(bot: Bot) -> None:
bot.add_cog(Inquiry(bot))
15 changes: 0 additions & 15 deletions cogs/ticket.py
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
from nextcord import Interaction, slash_command
from nextcord.ext.commands import Bot, Cog


class Ticket(Cog):
def __init__(self, bot: Bot) -> None:
self.bot = bot

@slash_command(name="ping", description="A simple ping command.")
async def ping(self, inter: Interaction) -> None:
await inter.send(f"Pong! {self.bot.latency * 1000:.2f}ms")


def setup(bot: Bot) -> None:
bot.add_cog(Ticket(bot))
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

print("[System] Beginning load...")
bot = Bot(command_prefix="!", intents=intents)
bot.load_extension("cogs.ticket")
bot.load_extension("cogs.inquiry")

@bot.event
async def on_ready():
Expand Down

0 comments on commit 5479921

Please sign in to comment.