Class ForumTagBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
public class ForumTagBuilder
- Inheritance
-
ForumTagBuilder
- Inherited Members
Constructors
ForumTagBuilder()
Initializes a new ForumTagBuilder class.
public ForumTagBuilder()
ForumTagBuilder(string, ulong?, bool)
Initializes a new ForumTagBuilder class with values
public ForumTagBuilder(string name, ulong? id = null, bool isModerated = false)
Parameters
name
stringName of the tag.
id
ulong?If set existing tag will be updated or a new one will be created otherwise.
isModerated
boolSets whether this tag can only be added to or removed from threads by a member with the ManageThreads permission.
ForumTagBuilder(string, ulong?, bool, IEmote?)
Initializes a new ForumTagBuilder class with values
public ForumTagBuilder(string name, ulong? id = null, bool isModerated = false, IEmote? emoji = null)
Parameters
name
stringName of the tag.
id
ulong?If set existing tag will be updated or a new one will be created otherwise.
isModerated
boolSets whether this tag can only be added to or removed from threads by a member with the ManageThreads permission.
emoji
IEmoteDisplay emoji of the tag.
ForumTagBuilder(string, ulong?, bool, ulong?)
Initializes a new ForumTagBuilder class with values
public ForumTagBuilder(string name, ulong? id = null, bool isModerated = false, ulong? emoteId = null)
Parameters
name
stringName of the tag.
id
ulong?If set existing tag will be updated or a new one will be created otherwise.
isModerated
boolSets whether this tag can only be added to or removed from threads by a member with the ManageThreads permission
emoteId
ulong?The id of custom Display emoji of the tag.
Fields
MaxNameLength
Returns the maximum length of name allowed by Discord.
public const int MaxNameLength = 20
Field Value
Properties
Emoji
Gets or sets the emoji of the tag.
public IEmote? Emoji { get; set; }
Property Value
Id
Gets or sets the snowflake Id of the tag.
public ulong? Id { get; set; }
Property Value
Remarks
If set this will update existing tag or will create a new one otherwise.
IsModerated
Gets or sets whether this tag can only be added to or removed from threads by a member with the ManageThreads permission
public bool IsModerated { get; set; }
Property Value
Name
Gets or sets the name of the tag.
public string? Name { get; set; }
Property Value
Exceptions
- ArgumentException
Name length must be less than or equal to MaxNameLength.
Methods
Build()
Builds the Tag.
public ForumTagProperties Build()
Returns
- ForumTagProperties
An instance of ForumTagProperties
Exceptions
- ArgumentNullException
"Name must be set to build the tag"
Equals(ForumTagBuilder?)
Gets whether supplied tag builder is equals to the current one.
public bool Equals(ForumTagBuilder? builder)
Parameters
builder
ForumTagBuilder
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
WithEmoji(IEmote?)
Sets the emoji of the tag.
public ForumTagBuilder WithEmoji(IEmote? emoji)
Parameters
emoji
IEmote
Returns
WithId(ulong?)
Sets the id of the tag.
public ForumTagBuilder WithId(ulong? id)
Parameters
id
ulong?If set existing tag will be updated or a new one will be created otherwise.
Returns
Exceptions
- ArgumentException
Name length must be less than or equal to MaxNameLength.
WithModerated(bool)
Sets whether this tag can only be added to or removed from threads by a member with the ManageThreads permission
public ForumTagBuilder WithModerated(bool moderated)
Parameters
moderated
bool
Returns
WithName(string)
Sets the name of the tag.
public ForumTagBuilder WithName(string name)
Parameters
name
string
Returns
Exceptions
- ArgumentException
Name length must be less than or equal to MaxNameLength.
Operators
operator ==(ForumTagBuilder?, ForumTagBuilder?)
public static bool operator ==(ForumTagBuilder? left, ForumTagBuilder? right)
Parameters
left
ForumTagBuilderright
ForumTagBuilder
Returns
operator !=(ForumTagBuilder?, ForumTagBuilder?)
public static bool operator !=(ForumTagBuilder? left, ForumTagBuilder? right)
Parameters
left
ForumTagBuilderright
ForumTagBuilder