diff --git a/cogs/inquiry.py b/cogs/inquiry.py index 221ba24..ccc7bd5 100644 --- a/cogs/inquiry.py +++ b/cogs/inquiry.py @@ -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 diff --git a/cogs/ticket.py b/cogs/ticket.py index 9dac272..233d969 100644 --- a/cogs/ticket.py +++ b/cogs/ticket.py @@ -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")) @@ -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)) diff --git a/main.py b/main.py index 50f4dad..a0471f6 100644 --- a/main.py +++ b/main.py @@ -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") diff --git a/views/ad.py b/views/ad.py index 3111d3b..14d03f6 100644 --- a/views/ad.py +++ b/views/ad.py @@ -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)