names

package
v0.0.0-...-a211759 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package names includes Map, a type that wraps a set of maps from IRC names to Discord IDs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map is a collection of mappings from IRC names to Discord IDs.

It contains bidirectional maps for:

  • Usernames to Discord users
  • Nicknames to Discord users
  • Channnels to Discord channels

func NewMap

func NewMap() *Map

NewMap returns a Map ready for use.

A Map must not be copied after first use.

func (*Map) ChannelID

func (m *Map) ChannelID(guildID discord.GuildID,
	channel string) discord.ChannelID

ChannelID returns the Discord ID for channel in guildID.

guildID must be a valid snowflake or the zero snowflake. channelID must not be empty.

func (*Map) ChannelName

func (m *Map) ChannelName(guildID discord.GuildID,
	channelID discord.ChannelID) string

ChannelName returns the IRC name for channelID in guildID.

guildID must be a valid snowflake or the zero snowflake. channelID must be a valid snowflake.

func (*Map) NickID

func (m *Map) NickID(guildID discord.GuildID, nick string) discord.UserID

NickID returns the Discord ID for nick in guildID.

guildID must be a valid snowflake or the zero snowflake. nick must not be empty.

func (*Map) NickName

func (m *Map) NickName(guildID discord.GuildID, userID discord.UserID) string

NickName returns the IRC name for userID in guildID.

guildID must be a valid snowflake or the zero snowflake. userID must be a valid snowflake.

func (*Map) UpdateChannel

func (m *Map) UpdateChannel(guildID discord.GuildID,
	channelID discord.ChannelID,
	ideal string) (before string, current string)

UpdateChannel updates the channel name entry for channelID in guildID with ideal. It returns the previous value and the current value as before and current respectively.

To remove an entry, pass an empty string as ideal. If before is empty, channelID was not in the map. If current is empty, channelID is no longer in the map.

func (*Map) UpdateNick

func (m *Map) UpdateNick(guildID discord.GuildID,
	userID discord.UserID, ideal string) (before string, current string)

UpdateNick updates the nickname entry for userID in guildID with ideal. It returns the previous value and the current value as before and current respectively.

To remove an entry, pass an empty string as ideal. If before is empty, userID was not in the map. If current is empty, userID is no longer in the map.

func (*Map) UpdateUser

func (m *Map) UpdateUser(userID discord.UserID,
	ideal string) (before string, current string)

UpdateUser updates the username entry for userID with ideal. It returns the previous value and the current value as before and current respectively.

To remove an entry, pass an empty string as ideal. If before is empty, userID was not in the map. If current is empty, userID is no longer in the map.

func (*Map) UserID

func (m *Map) UserID(name string) discord.UserID

UserID returns the Discord ID for name.

name must not be empty.

func (*Map) UserName

func (m *Map) UserName(userID discord.UserID) string

UserName returns the IRC name for userID.

userID must be a valid snowflake.

Jump to

Keyboard shortcuts

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