discord

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Discord用のbotsクライアントです.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageEmbedStyle_default

func MessageEmbedStyle_default(msg *proto.BotMsg, message *discordgo.MessageCreate) (sends []*discordgo.MessageSend)

デフォルトのMessageEmbedStyleです.

Types

type Instance

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

Discordの一つのセッションに対処するインスタンスです.

func NewInstance

func NewInstance(token string) (*Instance, error)

tokenを指定し, 新しいセッションを開始します.

func (*Instance) Close

func (instance *Instance) Close() error

Instanceを停止します.

func (*Instance) Open

func (instance *Instance) Open() error

Instanceを起動します.

func (*Instance) SetUnaryService

func (instance *Instance) SetUnaryService(bots *lib.BotsHandler, config UnaryServiceConfig)

Instanceに新しいUnaryServiceを設定します.

type MessagePreprocessor

type MessagePreprocessor func(msg string) (match bool, cmd string, arg *proto.Input)

テキストチャットでメッセージを受けとったときに実行される関数です. matchは対処を必要とするかどうかを表します. cmdは実行されるコマンド名を表します. argは実行されるコマンドに引き渡すInput構造体を表します.

func Preprocessor_prefix

func Preprocessor_prefix(prefix string) MessagePreprocessor

特定のPrefixに反応するMessagePreprocessorを返します.

type MessageStyle

type MessageStyle func(pb_out *proto.BotMsg, message_data *discordgo.MessageCreate) (message []*discordgo.MessageSend)

BotMsgとmessageのデータからmessageを作る関数を表します.

type UnaryServiceConfig

type UnaryServiceConfig struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

1メッセージ1レスポンスのサービスを表します

func NewUnaryServiceConfig

func NewUnaryServiceConfig(preprocessor MessagePreprocessor, style MessageStyle) (config UnaryServiceConfig)

メッセージを返すようなUnaryServiceを返します.

Jump to

Keyboard shortcuts

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