Documentation ¶
Index ¶
- Variables
- type ChannelNameChange
- type RemoveFunc
- type Session
- func (s *Session) ChannelFromName(guild discord.Snowflake, name string) discord.Snowflake
- func (s *Session) ChannelName(guild discord.Snowflake, id discord.Snowflake) (string, error)
- func (s *Session) Close() error
- func (s *Session) Messages(channelID discord.Snowflake) ([]discord.Message, error)
- func (s *Session) Ref()
- func (s *Session) Run() error
- func (s *Session) SubscribeUserList(guild discord.Snowflake, handler func(*UserNameChange)) (cancel func())
- func (s *Session) Unref() error
- func (s *Session) UserFromName(guild discord.Snowflake, name string) discord.Snowflake
- func (s *Session) UserName(guild discord.Snowflake, id discord.Snowflake) (string, error)
- type UserNameChange
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSnowflake = errors.New("invalid snowflake given")
var ErrNoChannel = errors.New("no channel by that name exists")
Functions ¶
This section is empty.
Types ¶
type ChannelNameChange ¶
type RemoveFunc ¶
type RemoveFunc func(s *Session)
RemoveFunc is a function type used to remove a Session from some storage when Close is called.
type Session ¶
Session is the reference-counted shared state between all clients for a Discord user.
func New ¶
func New(token string, debug bool, removeFunc RemoveFunc) (*Session, error)
New creates a new Session. removeFunc is a function that will called on Close.
func (*Session) ChannelFromName ¶
ChannelFromName returns the Discord channel for a given IRC channel name.
func (*Session) ChannelName ¶
ChannelName returns the IRC channel name for the given Discord channel ID.
func (*Session) Close ¶
Close calls the remove function given in New then closes the Discord connection.
func (*Session) Messages ¶
Messages overrides (*ningen.State).Messages. It is a temporary hack to process the users and members in a message before posting it, to avoid messages being sent before joins.
func (*Session) SubscribeUserList ¶
func (s *Session) SubscribeUserList(guild discord.Snowflake, handler func(*UserNameChange)) (cancel func())
While IsInitial is true, the callback will only be called in one goroutine. This function blocks until all events with IsInitial are sent.
func (*Session) UserFromName ¶
UserFromName returns the Discord user for the given IRC nickname.