diff --git a/DisCatSharp/Internals.cs b/DisCatSharp/Internals.cs index aba2cd938..d2530f510 100644 --- a/DisCatSharp/Internals.cs +++ b/DisCatSharp/Internals.cs @@ -1,94 +1,94 @@ // 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.Collections.Generic; using System.Text; using DisCatSharp.Entities; using DisCatSharp.Enums; namespace DisCatSharp; /// /// Internal tools. /// public static class Internals { /// /// Gets the version of the library /// private static string s_versionHeader => Utilities.VersionHeader; /// /// Gets the permission strings. /// private static Dictionary s_permissionStrings => Utilities.PermissionStrings; /// /// Gets the utf8 encoding /// internal static UTF8Encoding Utf8 => Utilities.UTF8; /// /// Initializes a new instance of the class. /// static Internals() { } /// /// Whether the is joinable via voice. /// /// The channel. internal static bool IsVoiceJoinable(this DiscordChannel channel) => channel.Type == ChannelType.Voice || channel.Type == ChannelType.Stage; /// /// Whether the can have threads. /// /// The channel. internal static bool IsThreadHolder(this DiscordChannel channel) => channel.Type == ChannelType.Text || channel.Type == ChannelType.News || channel.Type == ChannelType.Forum; /// /// Whether the is related to threads. /// /// The channel. - internal static bool IsThread(this DiscordChannel channel) => channel.Type == ChannelType.PublicThread || channel.Type == ChannelType.PrivateThread || channel.Type == ChannelType.NewsThread; + internal static bool IsThread(this DiscordChannel channel) => channel is DiscordThreadChannel; /// /// Whether users can write the . /// /// The channel. internal static bool IsWritable(this DiscordChannel channel) => channel.Type == ChannelType.PublicThread || channel.Type == ChannelType.PrivateThread || channel.Type == ChannelType.NewsThread || channel.Type == ChannelType.Text || channel.Type == ChannelType.News || channel.Type == ChannelType.Group || channel.Type == ChannelType.Private || channel.Type == ChannelType.Voice; /// /// Whether the is moveable in a parent. /// /// The channel. internal static bool IsMovableInParent(this DiscordChannel channel) => channel.Type == ChannelType.Voice || channel.Type == ChannelType.Stage || channel.Type == ChannelType.Text || channel.Type == ChannelType.Forum || channel.Type == ChannelType.News; /// /// Whether the is moveable. /// /// The channel. internal static bool IsMovable(this DiscordChannel channel) => channel.Type == ChannelType.Voice || channel.Type == ChannelType.Stage || channel.Type == ChannelType.Text || channel.Type == ChannelType.Category || channel.Type == ChannelType.Forum || channel.Type == ChannelType.News; }