diff --git a/experiment/Discord.Net.BuildOverrides/BuildOverrides.cs b/experiment/Discord.Net.BuildOverrides/BuildOverrides.cs
index 54b56cc605..54bc362ece 100644
--- a/experiment/Discord.Net.BuildOverrides/BuildOverrides.cs
+++ b/experiment/Discord.Net.BuildOverrides/BuildOverrides.cs
@@ -251,7 +251,7 @@ internal static void HandleLog(Override ovr, string msg)
private static Assembly _overrideDomain_Resolving(AssemblyLoadContext arg1, AssemblyName arg2)
{
// resolve the override id
- var v = _loadedOverrides.FirstOrDefault(x => x.Value.Any(x => x.Assembly.FullName == arg1.Assemblies.FirstOrDefault().FullName));
+ var v = _loadedOverrides.FirstOrDefault(x => x.Value.Any(x => x.Assembly.FullName == arg1.Assemblies.First().FullName));
return GetDependencyAsync(v.Key.Id, $"{arg2}").GetAwaiter().GetResult();
}
diff --git a/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs b/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs
index cb57b27265..52a70a6f57 100644
--- a/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/GuildFeature.cs
@@ -12,174 +12,174 @@ public enum GuildFeature : long
///
/// The guild has no features.
///
- None = 0,
+ None = 0L,
///
/// The guild has access to animated banners.
///
- AnimatedBanner = 1 << 0,
+ AnimatedBanner = 1L << 0,
///
/// The guild has access to set an animated guild icon.
///
- AnimatedIcon = 1 << 1,
+ AnimatedIcon = 1L << 1,
///
/// The guild has access to set a guild banner image.
///
- Banner = 1 << 2,
+ Banner = 1L << 2,
///
/// The guild has access to channel banners.
///
- ChannelBanner = 1 << 3,
+ ChannelBanner = 1L << 3,
///
/// The guild has access to use commerce features (i.e. create store channels).
///
- Commerce = 1 << 4,
+ Commerce = 1L << 4,
///
/// The guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates.
///
- Community = 1 << 5,
+ Community = 1L << 5,
///
/// The guild is able to be discovered in the directory.
///
- Discoverable = 1 << 6,
+ Discoverable = 1L << 6,
///
/// The guild has discoverable disabled.
///
- DiscoverableDisabled = 1 << 7,
+ DiscoverableDisabled = 1L << 7,
///
/// The guild has enabled discoverable before.
///
- EnabledDiscoverableBefore = 1 << 8,
+ EnabledDiscoverableBefore = 1L << 8,
///
/// The guild is able to be featured in the directory.
///
- Featureable = 1 << 9,
+ Featureable = 1L << 9,
///
/// The guild has a force relay.
///
- ForceRelay = 1 << 10,
+ ForceRelay = 1L << 10,
///
/// The guild has a directory entry.
///
- HasDirectoryEntry = 1 << 11,
+ HasDirectoryEntry = 1L << 11,
///
/// The guild is a hub.
///
- Hub = 1 << 12,
+ Hub = 1L << 12,
///
/// You shouldn't be here...
///
- InternalEmployeeOnly = 1 << 13,
+ InternalEmployeeOnly = 1L << 13,
///
/// The guild has access to set an invite splash background.
///
- InviteSplash = 1 << 14,
+ InviteSplash = 1L << 14,
///
/// The guild is linked to a hub.
///
- LinkedToHub = 1 << 15,
+ LinkedToHub = 1L << 15,
///
/// The guild has member profiles.
///
- MemberProfiles = 1 << 16,
+ MemberProfiles = 1L << 16,
///
/// The guild has enabled Membership Screening.
///
- MemberVerificationGateEnabled = 1 << 17,
+ MemberVerificationGateEnabled = 1L << 17,
///
/// The guild has enabled monetization.
///
- MonetizationEnabled = 1 << 18,
+ MonetizationEnabled = 1L << 18,
///
/// The guild has more emojis.
///
- MoreEmoji = 1 << 19,
+ MoreEmoji = 1L << 19,
///
/// The guild has increased custom sticker slots.
///
- MoreStickers = 1 << 20,
+ MoreStickers = 1L << 20,
///
/// The guild has access to create news channels.
///
- News = 1 << 21,
+ News = 1L << 21,
///
/// The guild has new thread permissions.
///
- NewThreadPermissions = 1 << 22,
+ NewThreadPermissions = 1L << 22,
///
/// The guild is partnered.
///
- Partnered = 1 << 23,
+ Partnered = 1L << 23,
///
/// The guild has a premium tier three override; guilds made by Discord usually have this.
///
- PremiumTier3Override = 1 << 24,
+ PremiumTier3Override = 1L << 24,
///
/// The guild can be previewed before joining via Membership Screening or the directory.
///
- PreviewEnabled = 1 << 25,
+ PreviewEnabled = 1L << 25,
///
/// The guild has access to create private threads.
///
- PrivateThreads = 1 << 26,
+ PrivateThreads = 1L << 26,
///
/// The guild has relay enabled.
///
- RelayEnabled = 1 << 27,
+ RelayEnabled = 1L << 27,
///
/// The guild is able to set role icons.
///
- RoleIcons = 1 << 28,
+ RoleIcons = 1L << 28,
///
/// The guild has role subscriptions available for purchase.
///
- RoleSubscriptionsAvailableForPurchase = 1 << 29,
+ RoleSubscriptionsAvailableForPurchase = 1L << 29,
///
/// The guild has role subscriptions enabled.
///
- RoleSubscriptionsEnabled = 1 << 30,
+ RoleSubscriptionsEnabled = 1L << 30,
///
/// The guild has access to the seven day archive time for threads.
///
- SevenDayThreadArchive = 1 << 31,
+ SevenDayThreadArchive = 1L << 31,
///
/// The guild has text in voice enabled.
///
- TextInVoiceEnabled = 1 << 32,
+ TextInVoiceEnabled = 1L << 32,
///
/// The guild has threads enabled.
///
- ThreadsEnabled = 1 << 33,
+ ThreadsEnabled = 1L << 33,
///
/// The guild has testing threads enabled.
///
- ThreadsEnabledTesting = 1 << 34,
+ ThreadsEnabledTesting = 1L << 34,
///
/// The guild has the default thread auto archive.
///
- ThreadsDefaultAutoArchiveDuration = 1 << 35,
+ ThreadsDefaultAutoArchiveDuration = 1L << 35,
///
/// The guild has access to the three day archive time for threads.
///
- ThreeDayThreadArchive = 1 << 36,
+ ThreeDayThreadArchive = 1L << 36,
///
/// The guild has enabled ticketed events.
///
- TicketedEventsEnabled = 1 << 37,
+ TicketedEventsEnabled = 1L << 37,
///
/// The guild has access to set a vanity URL.
///
- VanityUrl = 1 << 38,
+ VanityUrl = 1L << 38,
///
/// The guild is verified.
///
- Verified = 1 << 39,
+ Verified = 1L << 39,
///
/// The guild has access to set 384kbps bitrate in voice (previously VIP voice servers).
///
- VIPRegions = 1 << 40,
+ VIPRegions = 1L << 40,
///
/// The guild has enabled the welcome screen.
///
- WelcomeScreenEnabled = 1 << 41,
+ WelcomeScreenEnabled = 1L << 41,
}
}
diff --git a/src/Discord.Net.Interactions/TypeConverters/SlashCommands/NullableConverter.cs b/src/Discord.Net.Interactions/TypeConverters/SlashCommands/NullableConverter.cs
index 8741711754..d85b376d13 100644
--- a/src/Discord.Net.Interactions/TypeConverters/SlashCommands/NullableConverter.cs
+++ b/src/Discord.Net.Interactions/TypeConverters/SlashCommands/NullableConverter.cs
@@ -9,10 +9,11 @@ internal class NullableConverter : TypeConverter
public NullableConverter(InteractionService interactionService, IServiceProvider services)
{
- var type = Nullable.GetUnderlyingType(typeof(T));
+ var nullableType = typeof(T);
+ var type = Nullable.GetUnderlyingType(nullableType);
if (type is null)
- throw new ArgumentException($"No type {nameof(TypeConverter)} is defined for this {type.FullName}", "type");
+ throw new ArgumentException($"No type {nameof(TypeConverter)} is defined for this {nullableType.FullName}", nameof(type));
_typeConverter = interactionService.GetTypeConverter(type, services);
}
diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs
index e179675ba4..c5b075103b 100644
--- a/src/Discord.Net.Rest/DiscordRestApiClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs
@@ -1756,7 +1756,7 @@ public async Task CreateChannelInviteAsync(ulong channelId, Crea
if (args.TargetType.Value == TargetUserType.Stream)
Preconditions.GreaterThan(args.TargetUserId, 0, nameof(args.TargetUserId));
if (args.TargetType.Value == TargetUserType.EmbeddedApplication)
- Preconditions.GreaterThan(args.TargetApplicationId, 0, nameof(args.TargetUserId));
+ Preconditions.GreaterThan(args.TargetApplicationId, 0, nameof(args.TargetApplicationId));
}
options = RequestOptions.CreateOrClone(options);
diff --git a/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ThreadUpdateAuditLogData.cs b/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ThreadUpdateAuditLogData.cs
index 2b9b954183..8eb03114de 100644
--- a/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ThreadUpdateAuditLogData.cs
+++ b/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/ThreadUpdateAuditLogData.cs
@@ -15,7 +15,7 @@ private ThreadUpdateAuditLogData(IThreadChannel thread, ThreadType type, ThreadI
Thread = thread;
ThreadType = type;
Before = before;
- After = After;
+ After = after;
}
internal static ThreadUpdateAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry)
diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
index 8bab359371..20140994fc 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
@@ -428,7 +428,7 @@ public static async Task AddGuildUserAsync(IGuild guild, BaseDisc
var ids = args.Roles.Value.Select(r => r.Id);
if (args.RoleIds.IsSpecified)
- args.RoleIds.Value.Concat(ids);
+ args.RoleIds = Optional.Create(args.RoleIds.Value.Concat(ids));
else
args.RoleIds = Optional.Create(ids);
}
diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs b/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs
index 43d13f521b..ba2de12a94 100644
--- a/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs
+++ b/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs
@@ -426,7 +426,7 @@ async Task IDiscordInteraction.FollowupWithFileAsync(Stream fileSt
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
=> await FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
///
- async Task IDiscordInteraction.FollowupWithFileAsync(string filePath, string text, string fileName, Embed[] embeds, bool isTTS, bool ephemeral,
+ async Task IDiscordInteraction.FollowupWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral,
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
=> await FollowupWithFileAsync(filePath, text, fileName, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
///
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index 9ce2f507ac..cf01857e3e 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -532,13 +532,10 @@ internal void Update(ClientState state, Model model)
Features = model.Features;
var roles = new ConcurrentDictionary(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(model.Roles.Length * 1.05));
- if (model.Roles != null)
+ for (int i = 0; i < model.Roles.Length; i++)
{
- for (int i = 0; i < model.Roles.Length; i++)
- {
- var role = SocketRole.Create(this, state, model.Roles[i]);
- roles.TryAdd(role.Id, role);
- }
+ var role = SocketRole.Create(this, state, model.Roles[i]);
+ roles.TryAdd(role.Id, role);
}
_roles = roles;
diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketResolvableData.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketResolvableData.cs
index a629fd069f..98a7daefcc 100644
--- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketResolvableData.cs
+++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketResolvableData.cs
@@ -39,7 +39,7 @@ internal SocketResolvableData(DiscordSocketClient discord, ulong? guildId, T mod
{
foreach (var channel in resolved.Channels.Value)
{
- SocketChannel socketChannel = guild != null
+ var socketChannel = guild != null
? guild.GetChannel(channel.Value.Id)
: discord.GetChannel(channel.Value.Id);
@@ -69,7 +69,7 @@ internal SocketResolvableData(DiscordSocketClient discord, ulong? guildId, T mod
}
}
- if (resolved.Roles.IsSpecified)
+ if (resolved.Roles.IsSpecified && guild != null)
{
foreach (var role in resolved.Roles.Value)
{