Documentation ¶
Overview ¶
Package names includes Map, a type that wraps a set of maps from IRC names to Discord IDs.
Index ¶
- type Map
- func (m *Map) ChannelID(guildID discord.GuildID, channel string) discord.ChannelID
- func (m *Map) ChannelName(guildID discord.GuildID, channelID discord.ChannelID) string
- func (m *Map) NickID(guildID discord.GuildID, nick string) discord.UserID
- func (m *Map) NickName(guildID discord.GuildID, userID discord.UserID) string
- func (m *Map) UpdateChannel(guildID discord.GuildID, channelID discord.ChannelID, ideal string) (before string, current string)
- func (m *Map) UpdateNick(guildID discord.GuildID, userID discord.UserID, ideal string) (before string, current string)
- func (m *Map) UpdateUser(userID discord.UserID, ideal string) (before string, current string)
- func (m *Map) UserID(name string) discord.UserID
- func (m *Map) UserName(userID discord.UserID) string
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.