Added option to pin the first ticket message

This commit is contained in:
Toastie 2024-12-26 19:25:08 +13:00
parent 4f716dbbc9
commit 9ef4364a13
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
3 changed files with 32 additions and 35 deletions

View file

@ -235,7 +235,18 @@ public class NewCommand
Logger.Error("JsomMessage: " + e.JsonMessage);
}
await ticketChannel.SendMessageAsync("Hello, " + member.Mention + "!\n" + Config.welcomeMessage);
DiscordMessage message = await ticketChannel.SendMessageAsync("Hello, " + member.Mention + "!\n" + Config.welcomeMessage);
if (Config.pinFirstMessage)
{
try
{
await message.PinAsync();
}
catch (Exception e)
{
Logger.Error("Exception occurred trying to pin message: ", e);
}
}
// Refreshes the channel as changes were made to it above
ticketChannel = await SupportChild.client.GetChannelAsync(ticketChannel.Id);

View file

@ -19,6 +19,7 @@ internal static class Config
internal static string presenceText = "";
internal static bool newCommandUsesSelector = false;
internal static int ticketLimit = 5;
internal static bool pinFirstMessage = false;
internal static bool ticketUpdatedNotifications = false;
internal static double ticketUpdatedNotificationDelay = 0.0;
@ -86,6 +87,7 @@ internal static class Config
presenceText = json.SelectToken("bot.presence-text")?.Value<string>() ?? "";
newCommandUsesSelector = json.SelectToken("bot.new-command-uses-selector")?.Value<bool>() ?? false;
ticketLimit = json.SelectToken("bot.ticket-limit")?.Value<int>() ?? 5;
pinFirstMessage = json.SelectToken("bot.pin-first-message")?.Value<bool>() ?? false;
ticketUpdatedNotifications = json.SelectToken("notifications.ticket-updated")?.Value<bool>() ?? false;
ticketUpdatedNotificationDelay = json.SelectToken("notifications.ticket-updated-delay")?.Value<double>() ?? 0.0;

View file

@ -2,81 +2,65 @@
# Bot token.
token: "<add-token-here>"
# Channel where ticket logs are posted (recommended)
# Channel where ticket logs are posted (recommended).
log-channel: 000000000000000000
# Message posted when a ticket is opened.
welcome-message: "Please describe your issue below, and include all information needed for us to take action."
# Decides what messages are shown in console
# Decides what messages are shown in console.
# Possible values are: Critical, Error, Warning, Information, Debug.
console-log-level: "Information"
# One of the following: LongDate, LongDateTime, LongTime, RelativeTime, ShortDate, ShortDateTime, ShortTime
# One of the following: LongDate, LongDateTime, LongTime, RelativeTime, ShortDate, ShortDateTime, ShortTime.
# More info: https://dsharpplus.github.io/api/DSharpPlus.TimestampFormat.html
timestamp-format: "RelativeTime"
# Whether staff members should be randomly assigned tickets when they are made. Individual staff members can opt out using the toggleactive command.
# Whether or not staff members should be randomly assigned tickets when they are made. Individual staff members can opt out using the toggleactive command.
random-assignment: true
# If set to true the rasssign command will include staff members set as inactive if a specific role is specified in the command.
# This can be useful if you have admins set as inactive to not automatically receive tickets and then have moderators elevate tickets when needed.
random-assign-role-override: true
# Sets the type of activity for the bot to display in its presence status
# Possible values are: Playing, Streaming, ListeningTo, Watching, Competing
# Sets the type of activity for the bot to display in its presence status.
# Possible values are: Playing, Streaming, ListeningTo, Watching, Competing, Custom.
presence-type: "ListeningTo"
# Sets the activity text shown in the bot's status
presence-text: "/new"
# Set to true if you want the /new command to show a selection box instead of a series of buttons
# Set to true if you want the /new command to show a selection box instead of a series of buttons.
new-command-uses-selector: false
# Number of tickets a single user can have open at a time, staff members are excluded from this
# Number of tickets a single user can have open at a time, staff members are excluded from this.
ticket-limit: 5
# Pins the first message in a ticket to allow for quick navigation to the top in large tickets.
pin-first-message: true
notifications:
# Notifies the assigned staff member when a new message is posted in a ticket if the ticket has been silent for a configurable amount of time
# Notifies the assigned staff member when a new message is posted in a ticket if the ticket has been silent for a configurable amount of time.
# Other staff members and bots do not trigger this.
ticket-updated: true
# The above notification will only be sent if the ticket has been silent for more than this amount of days. Default is 0.5 days.
ticket-updated-delay: 0.5
# Notifies staff when they are assigned to tickets
# Notifies staff when they are assigned to tickets.
assignment: true
# Notifies the user opening the ticket that their ticket was closed and includes the transcript
# Notifies the user opening the ticket that their ticket was closed and includes the transcript.
closing: true
database:
# Address and port of the mysql server
# Address and port of the mysql server.
address: "127.0.0.1"
port: 3306
# Name of the database to use
# Name of the database to use.
name: "supportchild"
# Username and password for authentication
# Username and password for authentication.
user: ""
password: ""
# TODO: May want to move interview entries to subkey to make room for additional interview settings
interviews:
000000000000000000:
message: "Are you appealing your own ban or on behalf of another user?"
type: "BUTTONS"
color: "CYAN"
paths:
- "My own ban": # TODO: Can I add button color support somehow?
text: "What is your user name?"
type: "TEXT_INPUT"
summary-field: "Username"
paths:
- ".*":
text: "Please write your appeal below, motivate why you think you should be unbanned."
- "Another user's ban":
text: "You can only appeal your own ban. Please close this ticket."
type: "FAIL"
color: "CYAN"
password: ""