Table of Contents

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

value object

The name or id.

Exceptions

ArgumentException

DiscordIdentifier(string)

Creates the identifier by a name.

public DiscordIdentifier(string name)

Parameters

name string

The name.

DiscordIdentifier(ulong)

Creates the identifier by an id number.

public DiscordIdentifier(ulong id)

Parameters

id ulong

The id number.

Properties

Id

Gets the id.

public ulong Id { get; }

Property Value

ulong

Name

Gets the name. If this is null, the Id is used instead.

[JsonRootProperty]
public string? Name { get; }

Property Value

string

Methods

GetChannel<T>(IEnumerable<T>)

Gets the guild

public T? GetChannel<T>(IEnumerable<T> list) where T : IChannel

Parameters

list IEnumerable<T>

Returns

T

Type Parameters

T

GetGuild<T>(IEnumerable<T>)

Gets the guild

public T? GetGuild<T>(IEnumerable<T> list) where T : IGuild

Parameters

list IEnumerable<T>

Returns

T

Type Parameters

T

GetUser<T>(IEnumerable<T>)

Gets the guild

public T? GetUser<T>(IEnumerable<T> list) where T : IUser

Parameters

list IEnumerable<T>

Returns

T

Type Parameters

T

ToString()

Returns the name of the identifier.

public override string ToString()

Returns

string