lolicon

package module
v0.0.0-...-c46b426 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

README

go-lolicon

License

Apache 2.0

Documentation

Overview

Package lolicon implements Tenchou Fansub's Lolicon bot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugin

func RegisterPlugin(plugin Plugin)

RegisterPlugin registers a plugin.

This function panics if a plugin with the same id was already registered.

Types

type HelpProvider

type HelpProvider interface {
	Plugin

	// Help must return a map describing every supported command.
	//
	// A map key is the trigger for a command (without any prefix),
	// and its value is the description for that trigger.
	Help() map[string]string
}

HelpProvider is a plugin that provides information for the "help" command.

type Message

type Message struct {
	Date      time.Time `json:"date"`
	Content   string    `json:"content"`
	ChannelId string    `json:"channel_id"`
	UserId    string    `json:"user_id"`

	Command  string `json:"command"`
	Trailing string `json:"trailing"`

	IsAdmin bool `json:"is_admin"`

	Raw *RawMessageData `json:"raw"`
}

Message is a message from Discord.

type MessageHandler

type MessageHandler interface {
	Plugin
	HandleMessage(msg *Message) (done bool, err error)
}

MessageHandler is a plugin that can handle messages.

type Plugin

type Plugin interface {
	Id() PluginId

	// Setup is called when the plugin is loaded.
	Setup(storage storage.Driver) (err error)

	// Open is called when the connection to Discord has been
	// successfully established.
	Open(s *discordgo.Session) (err error)

	// Close is called after the connection to Discord has been closed.
	Close() (err error)
}

Plugin is a plugin.

func Plugins

func Plugins() []Plugin

Plugins returns a slice containing the registered plugins.

The slice is sorted in the order the plugins were registered. This means the first element of the slice is the plugin that was registered first.

type PluginId

type PluginId string

type RawMessageData

type RawMessageData struct {
	Session *discordgo.Session       `json:"-"`
	Event   *discordgo.MessageCreate `json:"event"`
}

RawMessageData contains the raw message received from Discord.

Directories

Path Synopsis
cmd
plugins
id
Package storage defines interfaces for persisting data in storage engines.
Package storage defines interfaces for persisting data in storage engines.
jsonstorage
Package jsonstorage implements the storage.Driver interface for persisting information in JSON files.
Package jsonstorage implements the storage.Driver interface for persisting information in JSON files.

Jump to

Keyboard shortcuts

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