Struct DiscordIdentifier
- Namespace
- BotManager.Discord.Models
- Assembly
- BotManager.Discord.dll
Identifies a guild, channel or user either by name or id.
[JsonConverter(typeof(DiscordIdentifierConverter))]
public readonly struct DiscordIdentifier
- Inherited Members
Constructors
DiscordIdentifier(object?)
Creates the identifier by an unknown type.
public DiscordIdentifier(object? value)
Parameters
valueobjectThe name or id.
Exceptions
DiscordIdentifier(string)
Creates the identifier by a name.
public DiscordIdentifier(string name)
Parameters
namestringThe name.
DiscordIdentifier(ulong)
Creates the identifier by an id number.
public DiscordIdentifier(ulong id)
Parameters
idulongThe id number.
Properties
Id
Gets the id.
public ulong Id { get; }
Property Value
Name
Gets the name. If this is null, the Id is used instead.
[JsonRootProperty]
public string? Name { get; }
Property Value
Methods
GetChannel<T>(IEnumerable<T>)
Gets the guild
public T? GetChannel<T>(IEnumerable<T> list) where T : IChannel
Parameters
listIEnumerable<T>
Returns
- T
Type Parameters
T
GetGuild<T>(IEnumerable<T>)
Gets the guild
public T? GetGuild<T>(IEnumerable<T> list) where T : IGuild
Parameters
listIEnumerable<T>
Returns
- T
Type Parameters
T
GetUser<T>(IEnumerable<T>)
Gets the guild
public T? GetUser<T>(IEnumerable<T> list) where T : IUser
Parameters
listIEnumerable<T>
Returns
- T
Type Parameters
T
ToString()
Returns the name of the identifier.
public override string ToString()