kitty

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 9 Imported by: 0

README

kitty

Your regular crap bot you all know and love.

Installation

  1. First you'll need Go, 1.4+ should be fine.
  2. Then setup your GOPATH to where ever you want it to go.
  3. Run go install github.com/acdenisSK/kitty
  4. Go to GOPATH/bin
  5. place config.toml.example there (don't forget to remove .example)
  6. replace the required fields and finally run the binary.
  7. You're good to go!

Notes

  • Please don't mind the unnecessary comments on some structs/functions. They're just there to comply with the linters, who unironically ask you to purposely add docs for publicly exported stuff.

Credits

  • iopred/bruxism (septapus) for some parts of the stat command and motivations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Field

func Field(name, value string) *discordgo.MessageEmbedField

Field is a shortcut to boilerplate.

func GetISOTimestamp

func GetISOTimestamp() string

GetISOTimestamp returns an ISO6301 based timestamp from the current time.

Types

type Checks

type Checks struct {
	OwnerOnly bool
}

Checks defines what to use when checking if for example the command is owner only, admin only, etc. Currently it's has "owner only"

type Command

type Command interface {
	Checks() Checks
	Process(Context)
}

Command defines what is considered a "command"

type Config

type Config struct {
	Required struct {
		Token   string
		Prefix  string
		OwnerID string `toml:"owner_id"`
	}
	Logging struct {
		File string
	}
}

Config maps how a general kitty config should be.

func GetConfig

func GetConfig() Config

GetConfig is used for acquiring configuration from a file called "config.toml" If it does not exist, this will panic.

type Context

type Context struct {
	Session *discordgo.Session
	State   *discordgo.State
	Message *discordgo.Message
	Author  *discordgo.User
	Channel *discordgo.Channel
	Guild   *discordgo.Guild
	Args    []string
}

Context f

func (Context) Edit

func (context Context) Edit(msgID, text string) (*discordgo.Message, error)

Edit ayy lmao

func (Context) Say

func (context Context) Say(text string) (*discordgo.Message, error)

Say ayy lmao

func (Context) SayEmbed

func (context Context) SayEmbed(msg *discordgo.MessageEmbed) (*discordgo.Message, error)

SayEmbed ayy lmao

type Kitty

type Kitty struct {
	Logger   *Logger
	Commands map[string]Command
	Config   Config
	Session  *discordgo.Session
}

Kitty the main struct of the bot

func New

func New(logger *Logger, commands map[string]Command, config Config, session *discordgo.Session) *Kitty

New creates a new kitty instance

func (*Kitty) Setup

func (k *Kitty) Setup()

Setup ... setups

type Logger

type Logger struct {
	*log.Logger
	sync.Mutex
	// contains filtered or unexported fields
}

Logger is a wrapper around `log`'s one but adds support for multiple outputs.

func (*Logger) AddOutput

func (l *Logger) AddOutput(writer io.Writer)

AddOutput adds an output for the logger. This is a one-time job so be careful on what writers you give this logger.

func (*Logger) Setup

func (l *Logger) Setup()

Setup setups the logger

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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