diff --git a/DisCatSharp/Entities/ThreadAndForum/ForumPostTag.cs b/DisCatSharp/Entities/ThreadAndForum/ForumPostTag.cs
index c164a115d..756f9898d 100644
--- a/DisCatSharp/Entities/ThreadAndForum/ForumPostTag.cs
+++ b/DisCatSharp/Entities/ThreadAndForum/ForumPostTag.cs
@@ -1,159 +1,159 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Linq;
using System.Threading.Tasks;
using DisCatSharp.Net.Models;
using Newtonsoft.Json;
namespace DisCatSharp.Entities;
///
/// Represents a discord forum post tag.
///
public class ForumPostTag : SnowflakeObject, IEquatable
{
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
public new ulong? Id;
///
/// Gets the channel id this tag belongs to.
///
[JsonIgnore]
internal ulong ChannelId;
///
/// Gets the channel this tag belongs to.
///
[JsonIgnore]
internal DiscordChannel Channel;
///
/// Gets the name of this forum post tag.
///
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; internal set; }
///
/// Gets the emoji id of the forum post tag.
///
[JsonProperty("emoji_id", NullValueHandling = NullValueHandling.Ignore)]
public ulong? EmojiId { get; internal set; }
///
/// Gets the unicode emoji of the forum post tag.
///
[JsonProperty("emoji_name", NullValueHandling = NullValueHandling.Include)]
public string? UnicodeEmojiString { get; internal set; }
///
/// Gets whether the tag can only be used by moderators.
///
[JsonProperty("moderated", NullValueHandling = NullValueHandling.Ignore)]
public bool? Moderated { get; internal set; }
///
/// Gets the emoji.
///
[JsonIgnore]
public DiscordEmoji Emoji
=> this.UnicodeEmojiString != null ? DiscordEmoji.FromName(this.Discord, $":{this.UnicodeEmojiString}:", false) : DiscordEmoji.FromGuildEmote(this.Discord, this.EmojiId.Value);
///
/// Modifies the tag.
///
/// This method is currently not implemented.
public async Task ModifyAsync(Action action)
{
var mdl = new ForumPostTagEditModel();
action(mdl);
var res = await this.Discord.ApiClient.ModifyForumChannelAsync(this.ChannelId, null, null, null, null, null, null, this.Channel.InternalAvailableTags.Where(x => x.Id != this.Id).ToList().Append(new ForumPostTag()
{
Id = this.Id,
Discord = this.Discord,
ChannelId = this.ChannelId,
Channel = this.Channel,
EmojiId = mdl.Emoji.HasValue ? mdl.Emoji.Value.Id : this.EmojiId,
Moderated = mdl.Moderated.HasValue ? mdl.Moderated.Value : this.Moderated,
Name = mdl.Name.HasValue ? mdl.Name.Value : this.Name,
UnicodeEmojiString = mdl.Emoji.HasValue ? mdl.Emoji.Value.Name : this.UnicodeEmojiString
}).ToList(), null, null, null, null, null, null, null, mdl.AuditLogReason);
return res.InternalAvailableTags.First(x => x.Id == this.Id);
}
///
/// Deletes the tag.
///
/// This method is currently not implemented.
public Task DeleteForumPostTagAsync(string reason = null)
- => this.Discord.ApiClient.ModifyForumChannelAsync(this.ChannelId, null, null, null, null, null, null, this.Channel.InternalAvailableTags.Where(x => x.Id != this.Id).ToList(), null, null, null, null, null, null, null, reason);
+ => this.Discord.ApiClient.ModifyForumChannelAsync(this.ChannelId, null, null, Optional.None, Optional.None, null, Optional.None, this.Channel.InternalAvailableTags.Where(x => x.Id != this.Id).ToList(), Optional.None, Optional.None, Optional.None, Optional.None, Optional.None, null, Optional.None, reason);
///
/// Checks whether this is equal to another object.
///
/// Object to compare to.
/// Whether the object is equal to this .
public override bool Equals(object obj)
=> this.Equals(obj as ForumPostTag);
///
/// Checks whether this is equal to another .
///
/// to compare to.
/// Whether the is equal to this .
public bool Equals(ForumPostTag e)
=> e is not null && (ReferenceEquals(this, e) || (this.Id == e.Id && this.Name == e.Name));
///
/// Gets the hash code for this .
///
/// The hash code for this .
public override int GetHashCode()
=> this.Id.GetHashCode();
///
/// Gets whether the two objects are equal.
///
/// First forum post tag to compare.
/// Second forum post tag to compare.
/// Whether the two forum post tags are equal.
public static bool operator ==(ForumPostTag e1, ForumPostTag e2)
{
var o1 = e1 as object;
var o2 = e2 as object;
return (o1 != null || o2 == null) && (o1 == null || o2 != null) && ((o1 == null && o2 == null) || e1.Id == e2.Id);
}
///
/// Gets whether the two objects are not equal.
///
/// First forum post tag to compare.
/// Second forum post tag to compare.
/// Whether the two forum post tags are not equal.
public static bool operator !=(ForumPostTag e1, ForumPostTag e2)
=> !(e1 == e2);
}