cagliostro

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

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Cagliostro (Discord)

Granblue Fantasy bot for Discord.

This bot exists as a free and open source alternative to the proprietary risend/vampy bot.

Features

Install

go get github.com/KuroiKitsu/discord-cagliostro/...

Configuration

Create a cagliostro.json file with this content:

{
  "token": "YOUR_TOKEN",
  "prefix": "!",
  "emoji_dir": "./media/emoji"
}

Running the bot

Just run it as cagliostro.

There must exist a cagliostro.json file in the working directory.

Commands

Command Arguments Description
events Display current and upcoming events.
emo name Display emoji name.

Available emoji

Check media/emoji directory.

If you want to use whoa.png, then the command is !emo whoa.

Contact

License

All the files under the media are from third-parties and may be subject to different licensing terms.

Everything else is licensed under Apache 2.0.

Documentation

Overview

Package cagliostro provides a Discord bot with functionality related to Granblue Fantasy.

Index

Constants

View Source
const (
	GBFLogoImageURL    = "https://u.nya.is/genvcc.png"
	GBFLogoImageWidth  = 273
	GBFLogoImageHeight = 187
)
View Source
const (
	EventCacheTTL = 30 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedEvent

type CachedEvent struct {
	Event     *gbf.Event
	Details   *gbf.EventDetails
	ExpiresAt time.Time
	// contains filtered or unexported fields
}

CachedEvent wraps an event, its details, and its expiration date.

type Cagliostro

type Cagliostro struct {
	Token    string
	Prefix   string
	EmojiDir string

	Logger Logger
	// contains filtered or unexported fields
}

Cagliostro is the main struct that wraps all the data required by the bot.

func (*Cagliostro) Close

func (c *Cagliostro) Close() error

Close terminates the connection with Discord.

func (*Cagliostro) CurrentEvents

func (c *Cagliostro) CurrentEvents() (events []*CachedEvent, err error)

CurrentEvents returns the ongoing events.

func (*Cagliostro) OnMessageCreate

func (c *Cagliostro) OnMessageCreate(s *discordgo.Session, m *discordgo.MessageCreate)

OnMessageCreate is the event handler for discordgo library.

func (*Cagliostro) Open

func (c *Cagliostro) Open() error

Open starts a connection with Discord.

func (*Cagliostro) UpcomingEvents

func (c *Cagliostro) UpcomingEvents() (events []*CachedEvent, err error)

UpcomingEvents returns the upcoming events.

type Logger

type Logger interface {
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Fatalln(v ...interface{})
	Panic(v ...interface{})
	Panicf(format string, v ...interface{})
	Panicln(v ...interface{})
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

Logger is a basic logging interface.

Directories

Path Synopsis
cmd
cagliostro command

Jump to

Keyboard shortcuts

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