tickets

package
v1.19.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Index

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 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[]
);
`, `
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);
`}

Functions

func RegisterPlugin

func RegisterPlugin()

func RequireActiveTicketMW

func RequireActiveTicketMW(inner dcmd.RunFunc) dcmd.RunFunc

func TicketLog

func TicketLog(conf *models.TicketConfig, guildID int64, author *discordgo.User, embed *discordgo.MessageEmbed)

Types

type CtxKey

type CtxKey int
const (
	CtxKeyConfig        CtxKey = iota
	CtxKeyCurrentTicket CtxKey = iota
)

type FormData

type FormData struct {
	GuildID                   int64
	Enabled                   bool
	TicketsChannelCategory    int64
	TicketsTranscriptsChannel int64
	StatusChannel             int64
	TicketsUseTXTTranscripts  bool
	DownloadAttachments       bool
	ModRoles                  []int64 `valid:"role"`
	AdminRoles                []int64 `valid:"role"`
	TicketOpenMSG             string  `valid:"template,10000"`
}

type Plugin

type Plugin struct{}

func (*Plugin) AddCommands

func (p *Plugin) AddCommands()

func (*Plugin) InitWeb

func (p *Plugin) InitWeb()

func (*Plugin) LoadServerHomeWidget added in v1.18.0

func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error)

func (*Plugin) PluginInfo

func (p *Plugin) PluginInfo() *common.PluginInfo

type Ticket

type Ticket struct {
	Ticket       *models.Ticket
	Participants []*models.TicketParticipant
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL