channeltracker

package
v0.0.0-...-89665df Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

Channel is an internal type for representing a channel.

func (*Channel) HasUser

func (c *Channel) HasUser(user string) bool

HasUser returns true if the user is in the channel, otherwise false.

type ChannelTracker

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

ChannelTracker is a simple plugin which is only meant to track what channels the bot is in, and what users are in a channel. It also provides a uuid mapping to a user, so if a user's nick changes, we'll still have a sort of "session" to keep track of them.

func CtxChannelTracker

func CtxChannelTracker(ctx context.Context) *ChannelTracker

CtxChannelTracker returns a reference to the channeltracker plugin instance from a given context

func (*ChannelTracker) Channels

func (p *ChannelTracker) Channels() []*Channel

Channels will return all the channel objects this bot knows about.

func (*ChannelTracker) LookupChannel

func (p *ChannelTracker) LookupChannel(channel string) *Channel

LookupChannel will return the Channel object for the given channel name or nil if we're not in that channel.

func (*ChannelTracker) LookupUser

func (p *ChannelTracker) LookupUser(user string) *User

LookupUser will return the User object for the given nick or nil if we don't know about this user. The returned value can be stored and will track this user even if they change nicks.

func (*ChannelTracker) LookupUserUUID

func (p *ChannelTracker) LookupUserUUID(id string) *User

LookupUserUUID will return the User object for the given nick or nil if we don't know about this user. The returned value can be stored and will track this user even if they change nicks.

func (*ChannelTracker) RegisterSessionCleanupCallback

func (p *ChannelTracker) RegisterSessionCleanupCallback(f func(u *User))

RegisterSessionCleanupCallback lets you register a function to be called when a session is removed.

func (*ChannelTracker) UsersInChannel

func (p *ChannelTracker) UsersInChannel(channel string) []*User

UsersInChannel will return all the users in the given channel name or nil if we're not in that channel.

type User

type User struct {
	Nick     string
	Username string
	Host     string
	Account  string
	Gecos    string
	UUID     string
	// contains filtered or unexported fields
}

User is an type for representing a user.

func (*User) Channels

func (u *User) Channels() []string

Channels returns which channels the user is currently in.

func (*User) InChannel

func (u *User) InChannel(channel string) bool

InChannel returns true if the user is in the channel, otherwise false.

func (*User) ModesInChannel

func (u *User) ModesInChannel(channel string) map[rune]bool

ModesInChannel returns a mapping of channel modes to a bool indicating if it's on or not for this user in this channel.

Jump to

Keyboard shortcuts

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