Skip to content

Commit

Permalink
chore!: remove deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Dec 20, 2023
1 parent c5aece2 commit 96b24f1
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 224 deletions.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions DisCatSharp.Common/Attributes/IncludeNullAttribute.cs

This file was deleted.

24 changes: 0 additions & 24 deletions DisCatSharp.Common/Attributes/SerializedNameAttribute.cs

This file was deleted.

10 changes: 0 additions & 10 deletions DisCatSharp/Clients/BaseDiscordClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,16 +476,6 @@ public async Task<GatewayInfo> GetGatewayInfoAsync(string token = null)
return await this.ApiClient.GetGatewayInfoAsync().ConfigureAwait(false);
}

/// <summary>
/// Gets some information about the development team behind DisCatSharp.
/// Can be used for crediting etc.
/// <para>Note: This call contacts servers managed by the DCS team, no information is collected.</para>
/// <returns>The team, or null with errors being logged on failure.</returns>
/// </summary>
[Deprecated("Don't use this right now, inactive")]
public async Task<DisCatSharpTeam> GetLibraryDevelopmentTeamAsync()
=> await DisCatSharpTeam.Get(this.RestClient, this.Logger, this.ApiClient).ConfigureAwait(false);

/// <summary>
/// Gets a cached user.
/// </summary>
Expand Down
17 changes: 0 additions & 17 deletions DisCatSharp/Clients/DiscordClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,23 +1237,6 @@ public async Task<DiscordApplicationCommand> EditGuildApplicationCommandAsync(ul
public Task DeleteGuildApplicationCommandAsync(ulong guildId, ulong commandId) =>
this.ApiClient.DeleteGuildApplicationCommandAsync(this.CurrentApplication.Id, guildId, commandId);

/// <summary>
/// Gets all command permissions for a guild.
/// </summary>
/// <param name="guildId">The target guild.</param>
[DiscordDeprecated("This was removed 2022")]
public Task<IReadOnlyList<DiscordGuildApplicationCommandPermission>> GetGuildApplicationCommandPermissionsAsync(ulong guildId)
=> null;

/// <summary>
/// Gets the permissions for a guild command.
/// </summary>
/// <param name="guildId">The target guild.</param>
/// <param name="commandId">The target command id.</param>
[DiscordDeprecated("This was removed 2022")]
public Task<DiscordGuildApplicationCommandPermission> GetApplicationCommandPermissionAsync(ulong guildId, ulong commandId)
=> null;

#endregion

#region Internal Caching Methods
Expand Down
7 changes: 0 additions & 7 deletions DisCatSharp/Clients/DiscordShardedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,6 @@ public async Task UpdateStatusAsync(DiscordActivity activity = null, UserStatus?
await Task.WhenAll(tasks).ConfigureAwait(false);
}

/// <summary>
/// <see cref="BaseDiscordClient.GetLibraryDevelopmentTeamAsync"/>
/// </summary>
[Obsolete("Don't use this right now, inactive")]
public async Task<DisCatSharpTeam> GetLibraryDevelopmentTeamAsync()
=> await this.GetShard(0).GetLibraryDevelopmentTeamAsync().ConfigureAwait(false);

#endregion

#region Internal Methods
Expand Down
32 changes: 0 additions & 32 deletions DisCatSharp/DiscordConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,36 +194,6 @@ public UdpClientFactoryDelegate UdpClientFactory
/// </summary>
public bool MobileStatus { internal get; set; } = false;

/// <summary>
/// <para>Whether to use canary. <see cref="UsePtb"/> has to be false.</para>
/// <para>Defaults to <see langword="false"/>.</para>
/// </summary>
[Deprecated("Use ApiChannel instead.")]
public bool UseCanary
{
internal get => this.ApiChannel == ApiChannel.Canary;
set
{
if (value)
this.ApiChannel = ApiChannel.Canary;
}
}

/// <summary>
/// <para>Whether to use ptb. <see cref="UseCanary"/> has to be false.</para>
/// <para>Defaults to <see langword="false"/>.</para>
/// </summary>
[Deprecated("Use ApiChannel instead.")]
public bool UsePtb
{
internal get => this.ApiChannel == ApiChannel.Ptb;
set
{
if (value)
this.ApiChannel = ApiChannel.Ptb;
}
}

/// <summary>
/// <para>Which api channel to use.</para>
/// <para>Defaults to <see cref="ApiChannel.Stable"/>.</para>
Expand Down Expand Up @@ -414,8 +384,6 @@ public DiscordConfiguration(DiscordConfiguration other)
this.Intents = other.Intents;
this.LoggerFactory = other.LoggerFactory;
this.MobileStatus = other.MobileStatus;
this.UseCanary = other.UseCanary;
this.UsePtb = other.UsePtb;
this.AutoRefreshChannelCache = other.AutoRefreshChannelCache;
this.ApiVersion = other.ApiVersion;
this.ServiceProvider = other.ServiceProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,12 @@ public async Task RemoveTagAsync(ForumPostTag tag, string reason = null)
/// <summary>
/// Archives a thread.
/// </summary>
/// <param name="locked">Whether the thread should be locked.</param>
/// <param name="reason">Reason for audit logs.</param>
/// <exception cref="UnauthorizedException">Thrown when the client does not have the <see cref="Permissions.ManageThreads"/> permission.</exception>
/// <exception cref="NotFoundException">Thrown when the thread does not exist.</exception>
/// <exception cref="BadRequestException">Thrown when an invalid parameter was provided.</exception>
/// <exception cref="ServerErrorException">Thrown when Discord is unable to process the request.</exception>
[DiscordDeprecated("The locked parameter will be removed soon and is not applied anymore.")]
public Task ArchiveAsync([DiscordDeprecated("The locked parameter will be removed soon and is not applied anymore.")] bool locked = true, string reason = null)
public Task ArchiveAsync(string reason = null)
=> this.Discord.ApiClient.ModifyThreadAsync(this.Id, this.Parent.Type, null, null, true, null, null, null, null, null, reason);

/// <summary>
Expand Down
36 changes: 1 addition & 35 deletions DisCatSharp/Entities/Optional.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,6 @@ public static Optional<T> FromNullable<T>(T value)
=> value == null
? None
: value;

/// <summary>
/// Creates a new <see cref="Optional{T}"/> with specified value and valid state.
/// </summary>
/// <param name="value">Value to populate the optional with.</param>
/// <typeparam name="T">Type of the value.</typeparam>
/// <returns>Created optional.</returns>
[Obsolete("Renamed to Some.")]
public static Optional<T> FromValue<T>(T value)
=> value;

/// <summary>
/// Creates a new empty <see cref="Optional{T}"/> with no value and invalid state.
/// </summary>
/// <typeparam name="T">The type that the created instance is wrapping around.</typeparam>
/// <returns>Created optional.</returns>
[Obsolete("Use None.")]
public static Optional<T> FromNoValue<T>()
=> default;
}

/// <summary>
Expand Down Expand Up @@ -119,21 +100,6 @@ public interface IOptional

private readonly T _val;

/// <summary>
/// Creates a new <see cref="Optional{T}"/> with specified value.
/// </summary>
/// <param name="value">Value of this option.</param>
[Obsolete("Use Optional.Some")]
public Optional(T value)
{
this._val = value;
this.HasValue = true;
}

[Obsolete("Renamed to Map")]
public Optional<TOut> IfPresent<TOut>(Func<T, TOut> mapper)
=> this.Map(mapper);

/// <summary>
/// Performs a mapping operation on the current <see cref="Optional{T}"/>, turning it into an Optional holding a
/// <typeparamref name="TOut"/> instance if the source optional contains a value; otherwise, returns an
Expand Down Expand Up @@ -249,7 +215,7 @@ public override int GetHashCode()

public static implicit operator Optional<T>(T val)
#pragma warning disable 0618
=> new(val);
=> Optional.Some(val);
#pragma warning restore 0618

public static explicit operator T(Optional<T> opt)
Expand Down
4 changes: 2 additions & 2 deletions DisCatSharp/Enums/Discord/DiscordDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ public enum UnusedDomain
/// <summary>
/// discordapp.io
/// </summary>
[Obsolete("Not in use.", false), DomainHelp("IO domain for discord", "discordapp.io")]
[DomainHelp("IO domain for discord", "discordapp.io")]
DiscordAppIo = 1,

/// <summary>
/// discordcdn.com
/// </summary>
[Obsolete("Not in use.", false), DomainHelp("Alternative CDN domain", "discordcdn.com")]
[DomainHelp("Alternative CDN domain", "discordcdn.com")]
DiscordCdnCom = 2
}

Expand Down
4 changes: 2 additions & 2 deletions DisCatSharp/Enums/User/PremiumType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using DisCatSharp.Attributes;

namespace DisCatSharp.Enums;

Expand All @@ -15,7 +15,7 @@ public enum PremiumType
/// <summary>
/// Includes basic app perks like animated emojis and avatars.
/// </summary>
[Obsolete("Nitro Classic got replaced by Nitro Basic")]
[DiscordDeprecated("Nitro Classic got replaced by Nitro Basic")]
NitroClassic = 1,

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ internal sealed class TransportApplication : ObservableApiObject
[JsonProperty("summary", NullValueHandling = NullValueHandling.Include), DiscordDeprecated("Empty string, will be removed in API v11")]
public string Summary { get; set; }

/// <summary>
/// Gets the bot user.
/// </summary>
[JsonProperty("bot", NullValueHandling = NullValueHandling.Ignore)]
public TransportUser Bot { get; set; }

Expand Down

0 comments on commit 96b24f1

Please sign in to comment.