feat: fetch from REST instead of cache for cross-cluster lookups
This commit is contained in:
@@ -81,7 +81,10 @@ public static class ContextChecksExt
|
||||
public static async Task<bool> CheckPermissionsInGuildChannel(this Context ctx, Channel channel,
|
||||
PermissionSet neededPerms)
|
||||
{
|
||||
var guild = await ctx.Cache.GetGuild(channel.GuildId.Value);
|
||||
// this is a quick hack, should probably do it properly eventually
|
||||
var guild = await ctx.Cache.TryGetGuild(channel.GuildId.Value);
|
||||
if (guild == null)
|
||||
await ctx.Rest.GetGuild(channel.GuildId.Value);
|
||||
if (guild == null)
|
||||
return false;
|
||||
|
||||
|
@@ -151,7 +151,10 @@ public static class ContextEntityArgumentsExt
|
||||
if (!MentionUtils.TryParseChannel(ctx.PeekArgument(), out var id))
|
||||
return null;
|
||||
|
||||
if (!(await ctx.Cache.TryGetChannel(id) is Channel channel))
|
||||
var channel = await ctx.Cache.TryGetChannel(id);
|
||||
if (channel == null)
|
||||
channel = await ctx.Rest.GetChannelOrNull(id);
|
||||
if (channel == null)
|
||||
return null;
|
||||
|
||||
if (!DiscordUtils.IsValidGuildChannel(channel))
|
||||
|
Reference in New Issue
Block a user