internal

package
v0.0.0-...-003bd84 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TOKEN_LENGTH = 64

Variables

This section is empty.

Functions

func GetJSON

func GetJSON(request string, i interface{}) error

func Hash

func Hash(salt, provided string) string

Hash takes a salt and provided string and returns their corresponding combined sha256 string

func MarshalJSON

func MarshalJSON(v interface{}) ([]byte, error)

func RandomString

func RandomString(length int) string

RandomString returns a random string with the specified length

func URLToken

func URLToken() string

func WriteTo

func WriteTo(w io.Writer, v interface{}) error

Types

type Card

type Card interface {
	Value() string
	Suit() string
}

type Deck

type Deck interface {
	Shuffle()
	Insert(Card)
	Draw() Card
	Peek() Card
	Next() Card
	Size() int
}

type FrenchCard

type FrenchCard struct {
	// contains filtered or unexported fields
}

FrenchCard is a struct for cards

func NewCard

func NewCard(v, s string) *FrenchCard

func (*FrenchCard) Suit

func (c *FrenchCard) Suit() string

func (*FrenchCard) Value

func (c *FrenchCard) Value() string

type FrenchDeck

type FrenchDeck struct {
	// contains filtered or unexported fields
}

func NewDeck

func NewDeck() *FrenchDeck

func NewHand

func NewHand() *FrenchDeck

func (*FrenchDeck) Draw

func (self *FrenchDeck) Draw() Card

func (*FrenchDeck) Insert

func (self *FrenchDeck) Insert(card Card)

func (*FrenchDeck) Next

func (self *FrenchDeck) Next() Card

func (*FrenchDeck) Peek

func (self *FrenchDeck) Peek() Card

func (*FrenchDeck) Shuffle

func (self *FrenchDeck) Shuffle()

Deck generates, shuffles, and deals a deck of 52 cards

func (*FrenchDeck) Size

func (self *FrenchDeck) Size() int

type Game

type Game interface {
	// Name returns the name of the module
	Name() string
	// Description returns the description of the module
	Description() string
	// Rules returns the specific rules of the module
	Rules() string
	// Start takes an "onFinish" function as well as the normal session and event params
	// It is called by the handler when the game starts
	Start(*discordgo.Session, *discordgo.MessageCreate, func()) bool
	// Finish should perform cleanup tasks and then call the "onFinish" function which was passed in at Start
	Finish(*discordgo.Session, *discordgo.MessageCreate)
	// Join is called when a player joins the game
	Join(*discordgo.Session, *discordgo.MessageCreate)
}

Game is a simple interface which allows you to add "game modules"

type Plugin

type Plugin interface {
	Run(args []string, s *discordgo.Session, m *discordgo.MessageCreate)
}

Jump to

Keyboard shortcuts

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