bot

package
v0.0.0-...-30c172c Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LAB_GHA            = "Complimentary Conference Lab: Get Go-ing with GitHub Actions"
	TWENTY_PERPET      = "One-Time 20%, plus Perpetual 10% Promo"
	COMMUNITY          = "Community Ticket"
	WORKSHOP_NLG       = "Pre-Conference Workshop: Next Level Go"
	WORKSHOP_DEBUG     = "Pre-Conference Workshop: Debugging Techniques for Go"
	WORKSHOP_ML        = "Pre-Conference Workshop: Infrastructure for ML Applications"
	WORKSHOP_CONCUR    = "Pre-Conference Workshop: Introduction to Concurrency in Go"
	WORKSHOP_SLS       = "Pre-Conference Workshop: Serverless Go"
	WORKSHOP_DGRAPH    = "Pre-Conference Workshop: Ultimate Dgraph with GraphQL and Go"
	ONETIME_TWENTY     = "One-Time 20% Promo"
	G2A_GROUP          = "G2A Grp Ticket"
	FRIENDS            = "Perpetual Promo: Friends of GopherCon"
	GEN_EARLY          = "General Admission - Early Gopher"
	GEN_SELF           = "General Admission - Self-Paid"
	WORKSHOP_PM_MICRO  = "P.M.Workshop: How to Structure Your Microservices"
	WORKSHOP_AM_CONCUR = "A.M. Workshop: Introduction to Concurrency in Go"
	WORKSHOP_AM_ML     = "A.M. Workshop: Infrastructure for ML Applications"
	WORKSHOP_PM_CONCUR = "P.M. Workshop: Introduction to Concurrency in Go"
	WORKSHOP_PM_SLS    = "P.M. Workshop: Serverless Go"
	WORKSHOP_PM_ML     = "P.M. Workshop: Infrastructure for ML Applications"
	WORKSHOP_AM_MICRO  = "A.M.Workshop: How to Structure Your Microservices"
	WORKSHOP_AM_DEBUG  = "A.M. Workshop: Debugging Techniques for Go"
	GEN_CORP           = "General Admission - Corporate"
	WORKSHOP_PM_K8S    = "P.M. Workshop: Go & Kubernetes in the Real World"
	WORKSHOP_AM_SLS    = "A.M. Workshop: Serverless Go"
	WORKSHOP_PM_DEBUG  = "P.M. Workshop: Debugging Techniques for Go"
	WORKSHOP_AM_K8S    = "A.M. Workshop: Go & Kubernetes in the Real World"
	WORKSHOP_PM_PACMAN = "P.M. Workshop: Pac-Man from Scratch"
	WORKSHOP_AM_PACMAN = "A.M. Workshop: Pac-Man from Scratch"
)

Variables

View Source
var TicketRole = map[string]string{
	LAB_GHA:            "WorkshopGithub",
	WORKSHOP_NLG:       "WorkshopNLG",
	WORKSHOP_AM_MICRO:  "WorkshopMicro",
	WORKSHOP_PM_MICRO:  "WorkshopMicro",
	WORKSHOP_DEBUG:     "WorkshopDebug",
	WORKSHOP_AM_DEBUG:  "WorkshopDebug",
	WORKSHOP_PM_DEBUG:  "WorkshopDebug",
	WORKSHOP_ML:        "WorkshopML",
	WORKSHOP_AM_ML:     "WorkshopML",
	WORKSHOP_PM_ML:     "WorkshopML",
	WORKSHOP_CONCUR:    "WorkshopConcur",
	WORKSHOP_AM_CONCUR: "WorkshopConcur",
	WORKSHOP_PM_CONCUR: "WorkshopConcur",
	WORKSHOP_SLS:       "WorkshopServerless",
	WORKSHOP_AM_SLS:    "WorkshopServerless",
	WORKSHOP_PM_SLS:    "WorkshopServerless",
	WORKSHOP_AM_K8S:    "WorkshopKubernetes",
	WORKSHOP_PM_K8S:    "WorkshopKubernetes",
	WORKSHOP_AM_PACMAN: "WorkshopPacman",
	WORKSHOP_PM_PACMAN: "WorkshopPacman",
	WORKSHOP_DGRAPH:    "WorkshopDgraph",
	GEN_EARLY:          "GC20 Ticket",
	GEN_SELF:           "GC20 Ticket",
	GEN_CORP:           "GC20 Ticket",
	COMMUNITY:          "GC20 Ticket",
	TWENTY_PERPET:      "GC20 Ticket",
	ONETIME_TWENTY:     "GC20 Ticket",
	FRIENDS:            "GC20 Ticket",
	G2A_GROUP:          "GC20 Ticket",
}

Functions

func GTicketFromAuto

func GTicketFromAuto(a AutoGenerated) []*database.GTicket

Types

type Arg

type Arg struct {
	Name              string
	Required          bool
	ValidationMessage string
	Value             string
}

type AutoGenerated

type AutoGenerated struct {
	ID          string `json:"id"`
	AccountID   int    `json:"accountId"`
	EventID     int    `json:"eventId"`
	Timestamp   int64  `json:"timestamp"`
	URL         string `json:"url"`
	TriggerName string `json:"triggerName"`
	PromoCode   string `json:"promoCode"`
	Details     struct {
		Items []struct {
			ContactFirstName       string `json:"contactFirstName"`
			ContactLastName        string `json:"contactLastName"`
			ContactEmail           string `json:"contactEmail"`
			ManageRegistrationLink string `json:"manageRegistrationLink"`
			TicketPaid             int    `json:"ticketPaid"`
			Currency               string `json:"currency"`
			Validity               string `json:"validity"`
			Status                 string `json:"status"`
			Created                string `json:"created"`
			MagicLink              string `json:"magicLink"`
			TicketID               int    `json:"ticketId"`
			RegistrationForm       struct {
				RefundPolicy   string `json:"refund_policy"`
				FirstName      string `json:"firstName"`
				Country        string `json:"country"`
				LastName       string `json:"lastName"`
				TwitterHandle2 string `json:"twitter_handle_2"`
				Company        string `json:"company"`
				Title          string `json:"title"`
				Email          string `json:"email"`
			} `json:"registrationForm"`
			PaymentStatus string `json:"paymentStatus"`
			ContactName   string `json:"contactName"`
			Discount      int    `json:"discount"`

			PromoCode  string `json:"promoCode"`
			Invoice    bool   `json:"invoice"`
			LedgerCode string `json:"ledgerCode"`
			TicketType string `json:"ticketType"`
			Type       string `json:"type"`
		} `json:"items"`
		ContactFirstName string `json:"contactFirstName"`
		ContactLastName  string `json:"contactLastName"`
		ContactEmail     string `json:"contactEmail"`
		Currency         string `json:"currency"`
		Status           string `json:"status"`
		OrderID          int    `json:"orderId"`
		Amount           int    `json:"amount"`
		PaymentStatus    string `json:"paymentStatus"`
		ContactName      string `json:"contactName"`
		Last4            string `json:"last4"`
		PaidVia          string `json:"paidVia"`
		Discount         int    `json:"discount"`
		Invoice          bool   `json:"invoice"`
		Quantity         int    `json:"quantity"`
		Action           string `json:"action"`
	} `json:"details"`
	Type string `json:"type"`
}

type Command

type Command struct {
	Bot         *Discord
	Trigger     string
	Args        []Arg
	Action      CommandAction
	Description string
}

func (*Command) Help

func (c *Command) Help() string

func (*Command) Parse

func (c *Command) Parse(rest string) error

type CommandAction

type CommandAction func(Command, *discordgo.Session, *discordgo.User, string) error

type Config

type Config struct {
	Token       string `json:"token"`
	LogChannel  string `json:"logChannel"`
	GopherGuild string `json:"gopherGuild"`
}

func NewConfig

func NewConfig(token, logChannel, gopherGuild string) *Config

func (*Config) GetGopherGuild

func (c *Config) GetGopherGuild() string

func (*Config) GetLogChannel

func (c *Config) GetLogChannel() string

func (*Config) GetToken

func (c *Config) GetToken() string

type Discord

type Discord struct {
	GuildRoles []*discordgo.Role
	// contains filtered or unexported fields
}

func NewDiscord

func NewDiscord(c *Config) *Discord

func (*Discord) Greet

func (d *Discord) Greet(u *discordgo.User)

func (*Discord) MessageCreate

func (d *Discord) MessageCreate(s *discordgo.Session, m *discordgo.MessageCreate)

MessageCreate is the function called on new message events

func (*Discord) PresenceUpdate

func (d *Discord) PresenceUpdate(s *discordgo.Session, m *discordgo.PresenceUpdate)

func (*Discord) ProcessCommand

func (d *Discord) ProcessCommand(dm bool, user *discordgo.User, channel, message string)

func (*Discord) ReconcileWorkshops

func (d *Discord) ReconcileWorkshops(s *discordgo.Session, m *discordgo.PresenceUpdate)

ReconcileWorkshops adds the GC20 Workshop role to people who should have had it

func (*Discord) Run

func (d *Discord) Run(quit chan bool) error

Run starts the Discord bot

func (*Discord) RunSchedule

func (d *Discord) RunSchedule(quit chan bool)

Jump to

Keyboard shortcuts

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