gateway

package
Version: v0.0.0-...-b7615f9 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	IntentGuilds uint32 = 1 << iota
	IntentGuildMembers
	IntentGuildBans
	IntentGuildEmojis
	IntentGuildIntegrations
	IntentGuildWebhooks
	IntentGuildInvites
	IntentGuildVoiceStates
	IntentGuildPresences
	IntentGuildMessages
	IntentGuildMessageReactions
	IntentGuildMessageTyping
	IntentDirectMessages
	IntentDirectMessageReactions
	IntentDirectMessageTyping
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelCreateHandler

type ChannelCreateHandler struct{}

func (*ChannelCreateHandler) Handle

func (_ *ChannelCreateHandler) Handle(s *Session, data []byte)

type ChannelDeleteHandler

type ChannelDeleteHandler struct{}

func (*ChannelDeleteHandler) Handle

func (_ *ChannelDeleteHandler) Handle(s *Session, data []byte)

type ChannelUpdateHandler

type ChannelUpdateHandler struct{}

func (*ChannelUpdateHandler) Handle

func (_ *ChannelUpdateHandler) Handle(s *Session, data []byte)

type EventHandler

type EventHandler interface {
	Handle(s *Session, data []byte)
}

type GuildBanAddHandler

type GuildBanAddHandler struct{}

func (*GuildBanAddHandler) Handle

func (_ *GuildBanAddHandler) Handle(s *Session, data []byte)

type GuildBanRemoveHandler

type GuildBanRemoveHandler struct{}

func (*GuildBanRemoveHandler) Handle

func (_ *GuildBanRemoveHandler) Handle(s *Session, data []byte)

type GuildCreateHandler

type GuildCreateHandler struct{}

func (*GuildCreateHandler) Handle

func (_ *GuildCreateHandler) Handle(s *Session, data []byte)

type GuildDeleteHandler

type GuildDeleteHandler struct{}

func (*GuildDeleteHandler) Handle

func (_ *GuildDeleteHandler) Handle(s *Session, data []byte)

type GuildEmojisUpdateHandler

type GuildEmojisUpdateHandler struct{}

func (*GuildEmojisUpdateHandler) Handle

func (_ *GuildEmojisUpdateHandler) Handle(s *Session, data []byte)

type GuildUpdateHandler

type GuildUpdateHandler struct{}

func (*GuildUpdateHandler) Handle

func (_ *GuildUpdateHandler) Handle(s *Session, data []byte)

type MessageCreateHandler

type MessageCreateHandler struct{}

func (*MessageCreateHandler) Handle

func (_ *MessageCreateHandler) Handle(s *Session, data []byte)

type Options

type Options struct {
	Token   string
	Intents uint32
}

type PresenceUpdateHandler

type PresenceUpdateHandler struct{}

func (*PresenceUpdateHandler) Handle

func (_ *PresenceUpdateHandler) Handle(s *Session, Data []byte)

type ReadyHandler

type ReadyHandler struct{}

func (*ReadyHandler) Handle

func (_ *ReadyHandler) Handle(s *Session, data []byte)

type ResumedHandler

type ResumedHandler struct{}

func (*ResumedHandler) Handle

func (_ *ResumedHandler) Handle(s *Session, _ []byte)

type Session

type Session struct {
	sync.RWMutex

	Channel  *rest.ChannelHandler
	Emoji    *rest.EmojiHandler
	Guild    *rest.GuildHandler
	Invite   *rest.InviteHandler
	Template *rest.TemplateHandler
	User     *rest.UserHandler
	Voice    *rest.VoiceHandler
	Webhook  *rest.WebhookHandler
	// contains filtered or unexported fields
}

func NewSession

func NewSession(options *Options) *Session

func (*Session) Bus

func (s *Session) Bus() *ev.EventBus

func (*Session) Close

func (s *Session) Close()

func (*Session) Latency

func (s *Session) Latency() time.Duration

func (*Session) Login

func (s *Session) Login() error

func (*Session) Me

func (s *Session) Me() *discord.User

func (*Session) On

func (s *Session) On(ev string, fn interface{}) error

func (*Session) Send

func (s *Session) Send(v interface{}) error

func (*Session) SetActivity

func (s *Session) SetActivity(activity *discord.Activity) error

func (*Session) SetStatus

func (s *Session) SetStatus(status string) error

func (*Session) State

func (s *Session) State() *State

func (*Session) UpdatePresence

func (s *Session) UpdatePresence(status *packet.UpdateStatus) error

type State

type State struct {
	Guilds   map[string]*discord.Guild
	Channels map[string]*discord.Channel
	Members  map[string]map[string]*discord.Member
	// contains filtered or unexported fields
}

func NewState

func NewState(session *Session) *State

func (*State) AddChannel

func (s *State) AddChannel(channel *discord.Channel)

func (*State) AddGuild

func (s *State) AddGuild(guild *discord.Guild)

func (*State) AddMember

func (s *State) AddMember(guildID string, member *discord.Member)

func (*State) Channel

func (s *State) Channel(id string) (*discord.Channel, error)

func (*State) Guild

func (s *State) Guild(id string) (*discord.Guild, error)

func (*State) Member

func (s *State) Member(guildID string, userID string) (*discord.Member, error)

func (*State) RemoveChannel

func (s *State) RemoveChannel(channel *discord.Channel)

func (*State) RemoveGuild

func (s *State) RemoveGuild(guild *discord.Guild)

func (*State) RemoveMember

func (s *State) RemoveMember(guildID string, member *discord.Member)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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