Ticketing System#120
Conversation
| ctx: BlockbotContext, | ||
| channel_option: arc.Option[ | ||
| hikari.TextableChannel, | ||
| arc.ChannelParams("A textable channel option.", name="channel"), |
There was a problem hiding this comment.
Could use a better option description
There was a problem hiding this comment.
Oops forgot to change the boilerplate code :P
| channel_option: arc.Option[ | ||
| hikari.TextableChannel, | ||
| arc.ChannelParams("A textable channel option.", name="channel"), |
There was a problem hiding this comment.
I think if you call the parameter channel (instead of channel_option) you don't have to specify name="channel" ... I think...
| arc.ChannelParams("A textable channel option.", name="channel"), | ||
| ], | ||
| ) -> None: | ||
| embed = hikari.Embed(title="Tickets", description="Create a ticket here!") |
There was a problem hiding this comment.
Could describe what you might open a ticket for
There was a problem hiding this comment.
Any suggestions on what to write? I feel like I'd just make it kind of long winded explaining it.
There was a problem hiding this comment.
Something like "Need to contact admins, helpdesk, or the whole committee? Open a ticket!" maybe?
| @plugin.listen() | ||
| async def button_click(event: hikari.InteractionCreateEvent) -> None: | ||
| if not isinstance(event.interaction, hikari.ComponentInteraction): | ||
| return | ||
| if event.interaction.custom_id != "meowmeow1": | ||
| return |
There was a problem hiding this comment.
You could use a single event listener which filters events and calls functions instead
e.g.
# one listener
@plugin.listen()
async def on_interaction(event: hikari.InteractionCreateEvent) -> None:
if isinstance(event, ComponentInteraction) and event.custom_id == "meowmeow1":
await handle_meowmeow1(event)
# repeat for all existing listeners
async def handle_meowmeow1(event: ComponentInteraction): # this could be ModalInteraction, etc
...| for value in ("admins", "helpdesk", "committee"): | ||
| committee_select.add_option(value.title(), value) | ||
| committee_label = se.LabelComponentBuilder( | ||
| label="Committee", component=committee_select |
There was a problem hiding this comment.
Is it possible to add a description here? e.g. "Who do you wish to contact"
| existing_names = { | ||
| channel.name | ||
| for channel in channels | ||
| if hasattr(channel, "parent_id") |
There was a problem hiding this comment.
I'd rather you check it's an instance of a category channel (not sure what the classname is) instead of checking for an attribute
There was a problem hiding this comment.
I tried searching for a way to search through the channels in the category but couldn't find them
There was a problem hiding this comment.
oh I meant something like
isinstance(channel, hikari.GuildCategory)instead of the hasattr check
| flags=hikari.MessageFlag.EPHEMERAL, | ||
| ) | ||
| await event.app.rest.create_message( | ||
| created_channel.id, f"<@&{permission_role}> <@{event.interaction.user.id}>" |
There was a problem hiding this comment.
You can just pass create_channel here. Although I'd rather you include this in the original message as the content. Also, to make it actually ping the role + user, you'll have to set the user_mentions and role_mentions parameters to True
There was a problem hiding this comment.
You can just pass create_channel here
Idk what you mean tbh.
Although I'd rather you include this in the original message as the content.
The original message (I assume you mean the one above it) is sent in the channel for creating tickets just for that user, the new one pings the user and role for who they want to contact.
Also, to make it actually ping the role + user, you'll have to set the user_mentions and role_mentions parameters to True
Thanks I'll make sure to set those parameters.
There was a problem hiding this comment.
Idk what you mean tbh.
create_channel instead of create_channel.id
original message
oh I meant the one with the embed send in the new channel sorry
e.g. create_message(content="<pings>", embed=embed, ...)
| hikari.ResponseType.MESSAGE_CREATE, | ||
| "Closing ticket...", | ||
| flags=hikari.MessageFlag.EPHEMERAL, | ||
| ) |
There was a problem hiding this comment.
Might want to sleep for a few seconds here (asyncio.sleep) so the user can actually see the message before the channel is deleted
There was a problem hiding this comment.
Good point, ill make it sleep for like 3 seconds
| CATEGORY_IDS: dict[str, int] = { | ||
| "official": 568810044309766151, | ||
| "administration": 568810044309766151, | ||
| "technical": 1202325296133701723, | ||
| "general": 627868752310042627, | ||
| "general-bots": 1202319516407697438, | ||
| "webgroup": 1202321207811395624, | ||
| "voice-channels": 568403964098248723, | ||
| "archive": 958448000496173056, | ||
| } |
There was a problem hiding this comment.
The only category we use is technical; there is no need to include the other categories.
There was a problem hiding this comment.
Its mainly for future use too, there's other dictionaries for things like roles in that file I thought I might as well complete it
There was a problem hiding this comment.
Its mainly for future use too, there's other dictionaries for things like roles in that file I thought I might as well complete it
Okay, but make sure that the correct IDs are used instead of placeholder ones. It would also be helpful if the dictionary keys matched the category names. But it would be good to keep the config file free of unnecessary parameters.
| async def delete_channel(event: hikari.InteractionCreateEvent) -> None: | ||
| if not isinstance(event.interaction, hikari.ComponentInteraction): | ||
| return | ||
| if event.interaction.custom_id != "moomoo1": |
There was a problem hiding this comment.
This is quite nice and funny naming, but it would be good to also have some context on the IDs used. Maybe something like moomoo-del might be better
A ticketing system where people can contact either helpdesk, admins or the entire committee privately through the Redbrick discord instead of DM's.
How it works: