Skip to content

Commit

Permalink
added add
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Dec 21, 2023
1 parent 4efb7b5 commit 3a50925
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cogs/inquiry.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async def accept(self, btn: nextcord.ui.Button, inter: nextcord.Interaction):
await new_channel.send(
content=f"<@{inter.user.id}> <@{ADVERTISING_ROLE}>",
embed=em,
view=AdView(PAID_CATEGORY),
view=AdView(PAID_CATEGORY, ADVERTISING_ROLE),
)
emb = nextcord.Embed()
emb.color = AD_EM_COLOR
Expand Down
17 changes: 16 additions & 1 deletion cogs/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from nextcord import slash_command
from nextcord.ext.commands import Bot, Cog
import nextcord
from .utils.colors import CLOSE_REQUEST
from .utils.colors import CLOSE_REQUEST, REPLY
from views.close import CloseView

CLOSED_CATEGORY = int(getenv("CLOSED_CATEGORY"))
Expand Down Expand Up @@ -71,6 +71,21 @@ async def close_request(self, inter: nextcord.Interaction):
embed=em, view=CloseRequest(inter=inter, old_channel=inter.channel)
)

@slash_command(name="add", description="add a person to the ticket")
async def add(
self,
inter: nextcord.Interaction,
user: nextcord.Member = nextcord.SlashOption(required=True),
):
em = nextcord.Embed()
em.color = REPLY
em.title = f"User Added"
em.description = f"<@{user.id}> has been added to this ticket."
await inter.channel.set_permissions(
user, read_messages=True, send_messages=True
)
await inter.channel.send(embed=em)


def setup(bot: Bot) -> None:
bot.add_cog(Ticket(bot))
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
intents = nextcord.Intents.default()
intents.message_content = True


print("[System] Beginning load...")
bot = Bot(command_prefix="!", intents=intents)
bot.load_extension("cogs.inquiry")
Expand Down
19 changes: 11 additions & 8 deletions views/ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@


class AdView(nextcord.ui.View):
def __init__(self, paid_category=None) -> None:
def __init__(self, paid_category=None, advertising_role=None) -> None:
super().__init__(timeout=None)
self.paid_category = paid_category
self.advertising_role = advertising_role

@nextcord.ui.button(
label="Mark Paid", style=nextcord.ButtonStyle.green, custom_id="ticket:paid"
)
async def paid(self, btn: nextcord.ui.Button, inter: nextcord.Interaction) -> None:
if isinstance(inter.channel, nextcord.TextChannel):
category = nextcord.utils.get(inter.guild.categories, id=self.paid_category)
await inter.channel.edit(category=category)
em = nextcord.Embed()
em.color = SUCCESS
em.title = ":checkmark: Payment Received"
em.description = """Thank you for your purchase!\nIf you haven't already, please send your advertisement message and ensure if you are using any custom/nitro-accessed Emojis that they are present within the Discord you are advertising (emojis from our server are fine, too).\n\nIf another advertisement was recently posted, out of courtesy it will be given a reasonable amount of uptime before yours is posted."""
await inter.response.send_message(embed=em)
print(self.advertising_role)
if inter.permissions.administrator or (nextcord.utils.get(inter.guild.roles, id=self.advertising_role) in inter.roles):
category = nextcord.utils.get(inter.guild.categories, id=self.paid_category)
await inter.channel.edit(category=category)
em = nextcord.Embed()
em.color = SUCCESS
em.title = ":checkmark: Payment Received"
em.description = """Thank you for your purchase!\nIf you haven't already, please send your advertisement message and ensure if you are using any custom/nitro-accessed Emojis that they are present within the Discord you are advertising (emojis from our server are fine, too).\n\nIf another advertisement was recently posted, out of courtesy it will be given a reasonable amount of uptime before yours is posted."""
await inter.response.send_message(embed=em)

0 comments on commit 3a50925

Please sign in to comment.