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 c752336 commit c92fd08
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
28 changes: 16 additions & 12 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import datetime
from nextcord import slash_command
from nextcord.ext.commands import Bot, Cog
from datetime import datetime
import nextcord
import json


with open("config.json", "r") as config_file:
with open("config.json", "r", encoding="utf-8") as config_file:
config = json.load(config_file)
REQUEST_CHANNEL: int = config["request_channel"]
AD_CHANNEL: int = config["advertise_channel"]
Expand All @@ -18,6 +18,14 @@
ADVERTISING_ROLE: int = 1096584186304942111


def get_date() -> str:
return datetime.now().strftime("%m/%d/%Y")


def get_time() -> str:
return datetime.now().strftime("%-I:%M %p")


class TicketView(nextcord.ui.View):
def __init__(self) -> None:
super().__init__(timeout=None)
Expand Down Expand Up @@ -102,9 +110,7 @@ async def callback(self, inter: nextcord.Interaction) -> None:
em.set_author(icon_url=inter.user.avatar, name=inter.user.name)
em.add_field(name="**CONTACT REQUEST ACCEPTED**", value="", inline=False)
em.add_field(name="**reason**", value=self.details.value, inline=False)
current_date = datetime.now().strftime("%m/%d/%Y")
current_time = datetime.now().strftime("%-I:%M %p")
em.set_footer(text=f"{inter.user.id}{current_date}{current_time}")
em.set_footer(text=f"{inter.user.id}{get_date()}{get_time()}")

await new_channel.send(
content=f"<@{inter.user.id}> <@{MARLOW_ID}> <@{ADVERTISING_ROLE}>",
Expand Down Expand Up @@ -137,9 +143,7 @@ async def callback(self, interaction: nextcord.Interaction) -> None:
em = nextcord.Embed()
em.set_author(icon_url=interaction.user.avatar, name=interaction.user.name)
em.add_field(name="**reason**", value=self.details.value)
current_date = datetime.now().strftime("%m/%d/%Y")
current_time = datetime.now().strftime("%-I:%M %p")
em.set_footer(text=f"{inter.user.id}{current_date}{current_time}")
em.set_footer(text=f"{inter.user.id}{get_date()}{get_time()}")

await target_channel.send(embed=em, view=RequestView())

Expand All @@ -150,16 +154,16 @@ def __init__(self, bot: Bot) -> None:
self.persistent_modal_added = False

@Cog.listener()
async def on_ready(self):
async def on_ready(self) -> None:
if not self.persistent_modal_added:
self.bot.add_view(RequestView())
self.bot.add_view(TicketView())
self.bot.add_view(AdView())
self.persistent_modal_added = True

@slash_command(name="deploy", description="Send inquiry embed")
async def deploy(self, ctx) -> None:
if isinstance(ctx.channel, nextcord.TextChannel):
async def deploy(self, inter: nextcord.Interaction) -> None:
if isinstance(inter.channel, nextcord.TextChannel):
em = nextcord.Embed(
title="📫 Contact Request",
description="""
Expand All @@ -171,7 +175,7 @@ async def deploy(self, ctx) -> None:
color=EMBED_COLOR,
)

await ctx.channel.send(embed=em, view=TicketView())
await inter.channel.send(embed=em, view=TicketView())


def setup(bot: Bot) -> None:
Expand Down
4 changes: 2 additions & 2 deletions cogs/ticket.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
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:
with open("config.json", "r", encoding="utf-8") as config_file:
config = json.load(config_file)


Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

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


if not TOKEN:
Expand Down

0 comments on commit c92fd08

Please sign in to comment.