db

package
v0.0.0-...-66193f1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegexUserPatternID = regexp.MustCompile(fmt.Sprintf(`<@.?[0-9]*?>`))

var RegexUserPatternID = regexp.MustCompile(fmt.Sprintf(`^(<@!(\d{%d,})>)$`, maxIDLength))

Functions

func ConnectToDB

func ConnectToDB() (*sqlx.DB, error)

ConnectToDB creates DB if it doesn't exist already

func CreateChallengeTable

func CreateChallengeTable(db *sqlx.DB) error

CreateChallengeTable this table stores values for challenge votes

func CreateScoreboardTable

func CreateScoreboardTable(db *sqlx.DB) error

CreateScoreboardTable this table stores results of challenge votes

func CreateVotingRecord

func CreateVotingRecord(db *sqlx.DB) error

CreateVotingRecord this table stores users' votes on each challenge

func MessageCreate

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

MessageCreate trigger>response for messagecreate events

func MessageReactionCreate

func MessageReactionCreate(s *discordgo.Session, r *discordgo.MessageReactionAdd)

MessageReactionCreate trigger>response for messagereactionadd events

func MessageReactionDelete

func MessageReactionDelete(s *discordgo.Session, r *discordgo.MessageReactionRemove)

MessageReactionDelete trigger>response for messagereactionremove events

Types

type ChallengeTableEntryStruct

type ChallengeTableEntryStruct struct {
	MessageID       string `db:"MessageID"`
	ChallengerID    string `db:"ChallengerID"`
	ChallengerName  string `db:"ChallengerName"`
	DefenderID      string `db:"DefenderID"`
	DefenderName    string `db:"DefenderName"`
	ChallengerVotes int    `db:"ChallengerVotes"`
	DefenderVotes   int    `db:"DefenderVotes"`
	AbstainVotes    int    `db:"AbstainVotes"`
	StopVotes       int    `db:"StopVotes"`
	Outcome         int    `db:"Outcome"`
}

ChallengeTableEntryStruct fields

type ScoreboardTableEntryStruct

type ScoreboardTableEntryStruct struct {
	UserID               string `db:"UserID"`
	Username             string `db:"Username"`
	TotalChallengeWins   int    `db:"TotalChallengeWins"`
	TotalChallengeLosses int    `db:"TotalChallengeLosses"`
	TotalChallengeTies   int    `db:"TotalChallengeTies"`
	TotalChallenges      int    `db:"TotalChallenges"`
	SuccessfulChallenges int    `db:"SuccessfulChallenges"`
	FailedChallenges     int    `db:"FailedChallenges"`
	SuccessfulDefenses   int    `db:"SuccessfulDefenses"`
	FailedDefenses       int    `db:"FailedDefenses"`
}

type VotesStruct

type VotesStruct struct {
	ChallengerVotes int `db:"ChallengerVotes"`
	DefenderVotes   int `db:"DefenderVotes"`
	AbstainVotes    int `db:"AbstainVotes"`
	StopVotes       int `db:"StopVotes"`
}

type VotingRecordEntryStruct

type VotingRecordEntryStruct struct {
	UserID          string `db:"UserID"`
	MessageID       string `db:"MessageID"`
	ChallengerVotes int    `db:"ChallengerVotes"`
	DefenderVotes   int    `db:"DefenderVotes"`
	AbstainVotes    int    `db:"AbstainVotes"`
	StopVotes       int    `db:"StopVotes"`
}

Jump to

Keyboard shortcuts

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