model

package
v0.0.0-...-f2ea9fe Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player struct {
	gorm.Model
	TeamID    string `gorm:"not null"`
	ChannelID string `gorm:"not null"`
	SlackID   string `gorm:"not null"`
	Name      string `gorm:"not null"`
	Image     string
	Points    float64 `gorm:"default:1000"`
}

Player stores the player points and personal info.

func GetAllPlayers

func GetAllPlayers(teamID, channelID string) []Player

GetAllPlayers list all players

func GetOrCreatePlayer

func GetOrCreatePlayer(teamID, channelID, slackID string) (Player, error)

GetOrCreatePlayer will try to find the player, if can't, will return an brand new one

func GetPlayer

func GetPlayer(teamID, channelID, slackID string) (Player, error)

GetPlayer returns a player given TeamID+ChannelID+SlackID

func GetPlayers

func GetPlayers(teamID, channelID string, limit int) []Player

GetPlayers list a number of players limited by the given threshold

func (*Player) Add

func (player *Player) Add()

Add adds a new player.

func (*Player) Delete

func (player *Player) Delete()

Delete removes locally the user from the DB.

func (*Player) GetBlockCard

func (player *Player) GetBlockCard() []ns.MixedElement

GetBlockCard calls GetBlockCardWithText using a default text

func (*Player) GetBlockCardWithText

func (player *Player) GetBlockCardWithText(before, after string) []ns.MixedElement

GetBlockCardWithText formats the Player Image and Name on a Slack Block Kit

func (*Player) GetPosition

func (player *Player) GetPosition() int

GetPosition returns the current position for the given player

func (*Player) IDStr

func (player *Player) IDStr() string

IDStr returns a simplified representation of Player IDs

func (*Player) IngestData

func (player *Player) IngestData()

IngestData calls Slack API to get Users data

func (*Player) ToStr

func (player *Player) ToStr() string

ToStr returns a string representation of Player

func (*Player) Update

func (player *Player) Update() (int, error)

Update a given player

Jump to

Keyboard shortcuts

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