Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTicket(ctx context.Context, gs *dstate.GuildSet, ms *dstate.MemberState, ...) (*dstate.GuildSet, *models.Ticket, error)
- func ProhibitActiveTicketMW(inner dcmd.RunFunc) dcmd.RunFunc
- func RegisterPlugin()
- func RequireActiveTicketMW(inner dcmd.RunFunc) dcmd.RunFunc
- func TicketCommandsRolesRunFuncfunc(gs *dstate.GuildSet) ([]int64, error)
- func TicketLog(conf *models.TicketConfig, guildID int64, author *discordgo.User, ...)
- type CtxKey
- type FormData
- type Plugin
- type TemplateTicket
- type Ticket
- type TicketUserError
Constants ¶
View Source
const ( DefaultTicketMsg = "{{$embed := cembed `description` (joinStr `` `Welcome ` .User.Mention `\n\nPlease describe the reasoning for opening this ticket, include any information you think may be relevant such as proof, other third parties and so on.` " + DefaultTicketMsgClose + DefaultTicketMsgAddUser + ")}}\n{{sendMessage nil $embed}}" DefaultTicketMsgClose = "\n\"\\n\\nuse the following command to close the ticket\\n\"\n\"`-ticket close reason for closing here`\\n\\n\"" DefaultTicketMsgAddUser = "\n\"use the following command to add users to the ticket\\n\"\n\"`-ticket adduser @user`\"" )
View Source
const ( AppendButtonsClose int64 = 1 << 0 AppendButtonsCloseWithReason int64 = 1 << 1 )
View Source
const InTicketPerms = discordgo.PermissionReadMessageHistory | discordgo.PermissionViewChannel | discordgo.PermissionSendMessages | discordgo.PermissionEmbedLinks | discordgo.PermissionAttachFiles
View Source
const TicketTXTDateFormat = "2006 Jan 02 15:04:05"
Variables ¶
View Source
var DBSchemas = []string{`
CREATE TABLE IF NOT EXISTS ticket_configs (
guild_id BIGINT PRIMARY KEY,
enabled BOOLEAN NOT NULL,
ticket_open_msg TEXT NOT NULL,
tickets_channel_category BIGINT NOT NULL,
status_channel BIGINT NOT NULL,
tickets_transcripts_channel BIGINT NOT NULL,
download_attachments BOOLEAN NOT NULL,
tickets_use_txt_transcripts BOOLEAN NOT NULL,
mod_roles BIGINT[],
admin_roles BIGINT[]
);
`, `
ALTER TABLE ticket_configs ADD COLUMN IF NOT EXISTS tickets_transcripts_channel_admin_only BIGINT NOT NULL DEFAULT 0;
`, `
ALTER TABLE ticket_configs ADD COLUMN IF NOT EXISTS append_buttons BIGINT NOT NULL DEFAULT 0;
`, `
CREATE TABLE IF NOT EXISTS tickets (
guild_id BIGINT NOT NULL,
local_id BIGINT NOT NULL,
channel_id BIGINT NOT NULL,
title TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
closed_at TIMESTAMP WITH TIME ZONE,
logs_id BIGINT NOT NULL,
author_id BIGINT NOT NULL,
author_username_discrim TEXT NOT NULL,
PRIMARY KEY(guild_id, local_id)
);
`, `
CREATE INDEX IF NOT EXISTS tickets_guild_id_channel_id_idx ON tickets(guild_id, channel_id);
`, `
CREATE TABLE IF NOT EXISTS ticket_participants (
ticket_guild_id BIGINT NOT NULL,
ticket_local_id BIGINT NOT NULL,
user_id BIGINT NOT NULL,
username TEXT NOT NULL,
discrim TEXT NOT NULL,
is_staff BOOLEAN NOT NULL,
-- This is bugged in sqlboiler, sooooo don't use it for now i guess
-- FOREIGN KEY (ticket_guild_id, ticket_local_id) REFERENCES tickets(guild_id, local_id) ON DELETE CASCADE,
PRIMARY KEY(ticket_guild_id, ticket_local_id, user_id)
);
`, `
CREATE INDEX IF NOT EXISTS ticket_participants_ticket_local_id_idx ON ticket_participants(ticket_guild_id, ticket_local_id);
`}
View Source
var PageHTML string
Functions ¶
func CreateTicket ¶
func ProhibitActiveTicketMW ¶ added in v2.49.0
func RegisterPlugin ¶
func RegisterPlugin()
func TicketLog ¶
func TicketLog(conf *models.TicketConfig, guildID int64, author *discordgo.User, embed *discordgo.MessageEmbed)
Types ¶
type FormData ¶
type FormData struct { GuildID int64 Enabled bool TicketsChannelCategory int64 `valid:"channel,true"` TicketsTranscriptsChannel int64 `valid:"channel,true"` TicketsTranscriptsChannelAdminOnly int64 `valid:"channel,true"` StatusChannel int64 `valid:"channel,true"` TicketsUseTXTTranscripts bool DownloadAttachments bool ModRoles []int64 `valid:"role"` AdminRoles []int64 `valid:"role"` TicketOpenMSG string `valid:"template,10000"` AppendButtonsClose bool AppendButtonsCloseWithReason bool }
type Plugin ¶
type Plugin struct{}
func (*Plugin) AddCommands ¶
func (p *Plugin) AddCommands()
func (*Plugin) LoadServerHomeWidget ¶
func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)
func (*Plugin) PluginInfo ¶
func (p *Plugin) PluginInfo() *common.PluginInfo
type TemplateTicket ¶
type TicketUserError ¶
type TicketUserError string
const ( ErrNoTicketCateogry TicketUserError = "No category for ticket channels set" ErrTitleTooLong TicketUserError = "" /* 127-byte string literal not displayed */ ErrMaxOpenTickets TicketUserError = "You're currently in over 10 open tickets on this server, please close some of the ones you're in." )
func (TicketUserError) Error ¶
func (t TicketUserError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.