internal

package
v0.0.0-...-2498082 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZWSP     = "\u200B"
	Response = ZWSP + "<@%s>: %s"
)

Variables

View Source
var (
	ErrNoConnection = fmt.Errorf("No connection has been built")
	Hearts          = []string{"❤", "♡", "❥", "ღ", "💕", "💞", "💝", "💘", "💖", "💓", "💗", "❦", "❧", "💟", "💌", "❣", "💔", "💙", "💚", "💛", "💜", "<3"}
	HeartResponses  = []string{
		":sparkling_heart::gift_heart::revolving_hearts::heart_decoration::love_letter:~k-kawaiiiiiiiiii!!!!!~!!!~~!!~:love_letter::heart_decoration::revolving_hearts::gift_heart::sparkling_heart:",
		"<3",
		":heart:",
		"ily %n",
		"tee hee, senpai noticed me",
		"わたしは、あなたを愛しています",
		"사랑해",
		"杀了自己",
		":heart:",
		"01101100011011110111011001100101",
		"`func heart(s *discordgo.Session, m *discordgo.MessageCreate) {\n\t" +
			"r := rand.New(rand.NewSource(time.Now().UnixNano()))\n\t" +
			"index := r.Int31n(int32(len(hearts)))\n\t" +
			"s.ChannelMessageSend(m.ChannelID, strings.ReplaceAll(heart[index], \"%n\", m.Author.Username, -1))\n" +
			"}`",
	}
)

Functions

func GetConnection

func GetConnection() *persistence.Connection

func MarshalJSON

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

func PrepareAndExecute

func PrepareAndExecute(query string, args ...interface{}) error

func Query

func Query(query string, args ...interface{}) (*sql.Rows, error)

func QueryRow

func QueryRow(query statement.Statement, data ...interface{}) error

func RequestJSON

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

func WriteTo

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

Types

type Card

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

type Command

type Command interface {
	Name() string
	Usage() string
	Summary() string
	Run([]string, *discordgo.Session, *discordgo.MessageCreate)
}

type Configuration

type Configuration struct {
	Bot struct {
		Token  string `json:"token"`
		Prefix string `json:"prefix"`
		Secret string `json:"secret"`
	} `json:"bot"`
	Google struct {
		Cx  string `json:"cx"`
		Key string `json:"key"`
	} `json:"google"`
	Weather struct {
		Key string `json:"key"`
	} `json:"weather"`
	Eti struct {
		Username string `json:"username"`
		Password string `json:"password"`
	} `json:"eti"`
	Sql struct {
		File string `json:"file"`
	} `json:"sql"`
}
var Config Configuration

type Deck

type Deck interface {
	Shuffle()
	Insert(Card)
	Draw() Card
	Peek() Card
	Next() Card
	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 Responder

type Responder func([]string, *discordgo.Session, *discordgo.MessageCreate)

type Role

type Role interface {
	ID() int
	Name() string
	HasPermission(string) bool
}

type Runner

type Runner func([]string, *discordgo.Session, *discordgo.MessageCreate)

type SearchData

type SearchData struct {
	Items []struct {
		Kind, Title, HTMLTitle, Link, DisplayLink, Snippet, HTMLSnippet, CacheID, FormattedURL, HTMLFormattedURL string
	}
	Error struct {
		Message string
	}
}

type User

type User interface {
	ID() string
	HasPermission(string, string) bool
}

type WeatherData

type WeatherData struct {
	Weather []struct {
		Id                      int
		Main, Description, Icon string
	}
	Main struct {
		Temp, Pressure, Humidity, Temp_min, Temp_max, Sea_level, Grnd_level float64
	}
	Wind struct {
		Speed, Deg float64
	}
	Name string
}

type YoutubeData

type YoutubeData struct {
	Items []struct {
		Id struct {
			VideoID string `json:"videoId"`
		} `json:"id"`
		Snippet struct {
			Title        string `json:"title"`
			Description  string `json:"description"`
			ChannelTitle string `json:"channelTitle"`
			ChannelID    string `json:"channelId"`
		} `json:"snippet"`
	}
}

Jump to

Keyboard shortcuts

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