fix: Range of issues presented by analyzer (#2404)
This commit is contained in:
@@ -251,7 +251,7 @@ namespace Discord
|
|||||||
private static Assembly _overrideDomain_Resolving(AssemblyLoadContext arg1, AssemblyName arg2)
|
private static Assembly _overrideDomain_Resolving(AssemblyLoadContext arg1, AssemblyName arg2)
|
||||||
{
|
{
|
||||||
// resolve the override id
|
// 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();
|
return GetDependencyAsync(v.Key.Id, $"{arg2}").GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,174 +12,174 @@ namespace Discord
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has no features.
|
/// The guild has no features.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None = 0,
|
None = 0L,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to animated banners.
|
/// The guild has access to animated banners.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AnimatedBanner = 1 << 0,
|
AnimatedBanner = 1L << 0,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set an animated guild icon.
|
/// The guild has access to set an animated guild icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AnimatedIcon = 1 << 1,
|
AnimatedIcon = 1L << 1,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set a guild banner image.
|
/// The guild has access to set a guild banner image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Banner = 1 << 2,
|
Banner = 1L << 2,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to channel banners.
|
/// The guild has access to channel banners.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ChannelBanner = 1 << 3,
|
ChannelBanner = 1L << 3,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to use commerce features (i.e. create store channels).
|
/// The guild has access to use commerce features (i.e. create store channels).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Commerce = 1 << 4,
|
Commerce = 1L << 4,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates.
|
/// The guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Community = 1 << 5,
|
Community = 1L << 5,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is able to be discovered in the directory.
|
/// The guild is able to be discovered in the directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Discoverable = 1 << 6,
|
Discoverable = 1L << 6,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has discoverable disabled.
|
/// The guild has discoverable disabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DiscoverableDisabled = 1 << 7,
|
DiscoverableDisabled = 1L << 7,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled discoverable before.
|
/// The guild has enabled discoverable before.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EnabledDiscoverableBefore = 1 << 8,
|
EnabledDiscoverableBefore = 1L << 8,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is able to be featured in the directory.
|
/// The guild is able to be featured in the directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Featureable = 1 << 9,
|
Featureable = 1L << 9,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has a force relay.
|
/// The guild has a force relay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ForceRelay = 1 << 10,
|
ForceRelay = 1L << 10,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has a directory entry.
|
/// The guild has a directory entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
HasDirectoryEntry = 1 << 11,
|
HasDirectoryEntry = 1L << 11,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is a hub.
|
/// The guild is a hub.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Hub = 1 << 12,
|
Hub = 1L << 12,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// You shouldn't be here...
|
/// You shouldn't be here...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
InternalEmployeeOnly = 1 << 13,
|
InternalEmployeeOnly = 1L << 13,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set an invite splash background.
|
/// The guild has access to set an invite splash background.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
InviteSplash = 1 << 14,
|
InviteSplash = 1L << 14,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is linked to a hub.
|
/// The guild is linked to a hub.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LinkedToHub = 1 << 15,
|
LinkedToHub = 1L << 15,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has member profiles.
|
/// The guild has member profiles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MemberProfiles = 1 << 16,
|
MemberProfiles = 1L << 16,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled <seealso href="https://discord.com/developers/docs/resources/guild#membership-screening-object">Membership Screening</seealso>.
|
/// The guild has enabled <seealso href="https://discord.com/developers/docs/resources/guild#membership-screening-object">Membership Screening</seealso>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MemberVerificationGateEnabled = 1 << 17,
|
MemberVerificationGateEnabled = 1L << 17,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled monetization.
|
/// The guild has enabled monetization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MonetizationEnabled = 1 << 18,
|
MonetizationEnabled = 1L << 18,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has more emojis.
|
/// The guild has more emojis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MoreEmoji = 1 << 19,
|
MoreEmoji = 1L << 19,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has increased custom sticker slots.
|
/// The guild has increased custom sticker slots.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MoreStickers = 1 << 20,
|
MoreStickers = 1L << 20,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to create news channels.
|
/// The guild has access to create news channels.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
News = 1 << 21,
|
News = 1L << 21,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has new thread permissions.
|
/// The guild has new thread permissions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NewThreadPermissions = 1 << 22,
|
NewThreadPermissions = 1L << 22,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is partnered.
|
/// The guild is partnered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Partnered = 1 << 23,
|
Partnered = 1L << 23,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has a premium tier three override; guilds made by Discord usually have this.
|
/// The guild has a premium tier three override; guilds made by Discord usually have this.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PremiumTier3Override = 1 << 24,
|
PremiumTier3Override = 1L << 24,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild can be previewed before joining via Membership Screening or the directory.
|
/// The guild can be previewed before joining via Membership Screening or the directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PreviewEnabled = 1 << 25,
|
PreviewEnabled = 1L << 25,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to create private threads.
|
/// The guild has access to create private threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PrivateThreads = 1 << 26,
|
PrivateThreads = 1L << 26,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has relay enabled.
|
/// The guild has relay enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RelayEnabled = 1 << 27,
|
RelayEnabled = 1L << 27,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is able to set role icons.
|
/// The guild is able to set role icons.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RoleIcons = 1 << 28,
|
RoleIcons = 1L << 28,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has role subscriptions available for purchase.
|
/// The guild has role subscriptions available for purchase.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RoleSubscriptionsAvailableForPurchase = 1 << 29,
|
RoleSubscriptionsAvailableForPurchase = 1L << 29,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has role subscriptions enabled.
|
/// The guild has role subscriptions enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RoleSubscriptionsEnabled = 1 << 30,
|
RoleSubscriptionsEnabled = 1L << 30,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to the seven day archive time for threads.
|
/// The guild has access to the seven day archive time for threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SevenDayThreadArchive = 1 << 31,
|
SevenDayThreadArchive = 1L << 31,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has text in voice enabled.
|
/// The guild has text in voice enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TextInVoiceEnabled = 1 << 32,
|
TextInVoiceEnabled = 1L << 32,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has threads enabled.
|
/// The guild has threads enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ThreadsEnabled = 1 << 33,
|
ThreadsEnabled = 1L << 33,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has testing threads enabled.
|
/// The guild has testing threads enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ThreadsEnabledTesting = 1 << 34,
|
ThreadsEnabledTesting = 1L << 34,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has the default thread auto archive.
|
/// The guild has the default thread auto archive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ThreadsDefaultAutoArchiveDuration = 1 << 35,
|
ThreadsDefaultAutoArchiveDuration = 1L << 35,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to the three day archive time for threads.
|
/// The guild has access to the three day archive time for threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ThreeDayThreadArchive = 1 << 36,
|
ThreeDayThreadArchive = 1L << 36,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled ticketed events.
|
/// The guild has enabled ticketed events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TicketedEventsEnabled = 1 << 37,
|
TicketedEventsEnabled = 1L << 37,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set a vanity URL.
|
/// The guild has access to set a vanity URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VanityUrl = 1 << 38,
|
VanityUrl = 1L << 38,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is verified.
|
/// The guild is verified.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Verified = 1 << 39,
|
Verified = 1L << 39,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set 384kbps bitrate in voice (previously VIP voice servers).
|
/// The guild has access to set 384kbps bitrate in voice (previously VIP voice servers).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VIPRegions = 1 << 40,
|
VIPRegions = 1L << 40,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled the welcome screen.
|
/// The guild has enabled the welcome screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WelcomeScreenEnabled = 1 << 41,
|
WelcomeScreenEnabled = 1L << 41,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ namespace Discord.Interactions
|
|||||||
|
|
||||||
public NullableConverter(InteractionService interactionService, IServiceProvider services)
|
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)
|
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);
|
_typeConverter = interactionService.GetTypeConverter(type, services);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1756,7 +1756,7 @@ namespace Discord.API
|
|||||||
if (args.TargetType.Value == TargetUserType.Stream)
|
if (args.TargetType.Value == TargetUserType.Stream)
|
||||||
Preconditions.GreaterThan(args.TargetUserId, 0, nameof(args.TargetUserId));
|
Preconditions.GreaterThan(args.TargetUserId, 0, nameof(args.TargetUserId));
|
||||||
if (args.TargetType.Value == TargetUserType.EmbeddedApplication)
|
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);
|
options = RequestOptions.CreateOrClone(options);
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Discord.Rest
|
|||||||
Thread = thread;
|
Thread = thread;
|
||||||
ThreadType = type;
|
ThreadType = type;
|
||||||
Before = before;
|
Before = before;
|
||||||
After = After;
|
After = after;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static ThreadUpdateAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry)
|
internal static ThreadUpdateAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry)
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ namespace Discord.Rest
|
|||||||
var ids = args.Roles.Value.Select(r => r.Id);
|
var ids = args.Roles.Value.Select(r => r.Id);
|
||||||
|
|
||||||
if (args.RoleIds.IsSpecified)
|
if (args.RoleIds.IsSpecified)
|
||||||
args.RoleIds.Value.Concat(ids);
|
args.RoleIds = Optional.Create(args.RoleIds.Value.Concat(ids));
|
||||||
else
|
else
|
||||||
args.RoleIds = Optional.Create(ids);
|
args.RoleIds = Optional.Create(ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ namespace Discord.Rest
|
|||||||
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
||||||
=> await FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
=> await FollowupWithFileAsync(fileStream, fileName, text, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(string filePath, string text, string fileName, Embed[] embeds, bool isTTS, bool ephemeral,
|
async Task<IUserMessage> IDiscordInteraction.FollowupWithFileAsync(string filePath, string fileName, string text, Embed[] embeds, bool isTTS, bool ephemeral,
|
||||||
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
AllowedMentions allowedMentions, MessageComponent components, Embed embed, RequestOptions options)
|
||||||
=> await FollowupWithFileAsync(filePath, text, fileName, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
=> await FollowupWithFileAsync(filePath, text, fileName, embeds, isTTS, ephemeral, allowedMentions, components, embed, options).ConfigureAwait(false);
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|||||||
@@ -532,13 +532,10 @@ namespace Discord.WebSocket
|
|||||||
Features = model.Features;
|
Features = model.Features;
|
||||||
|
|
||||||
var roles = new ConcurrentDictionary<ulong, SocketRole>(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(model.Roles.Length * 1.05));
|
var roles = new ConcurrentDictionary<ulong, SocketRole>(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;
|
_roles = roles;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Discord.WebSocket
|
|||||||
{
|
{
|
||||||
foreach (var channel in resolved.Channels.Value)
|
foreach (var channel in resolved.Channels.Value)
|
||||||
{
|
{
|
||||||
SocketChannel socketChannel = guild != null
|
var socketChannel = guild != null
|
||||||
? guild.GetChannel(channel.Value.Id)
|
? guild.GetChannel(channel.Value.Id)
|
||||||
: discord.GetChannel(channel.Value.Id);
|
: discord.GetChannel(channel.Value.Id);
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ namespace Discord.WebSocket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolved.Roles.IsSpecified)
|
if (resolved.Roles.IsSpecified && guild != null)
|
||||||
{
|
{
|
||||||
foreach (var role in resolved.Roles.Value)
|
foreach (var role in resolved.Roles.Value)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user