fix: get guild from REST for pk;proxy across clusters
also closes #330.
This commit is contained in:
parent
494f93d629
commit
973d6d883c
@ -166,18 +166,13 @@ public static class ContextEntityArgumentsExt
|
|||||||
|
|
||||||
public static async Task<Guild> MatchGuild(this Context ctx)
|
public static async Task<Guild> MatchGuild(this Context ctx)
|
||||||
{
|
{
|
||||||
try
|
if (!ulong.TryParse(ctx.PeekArgument(), out var id))
|
||||||
{
|
return null;
|
||||||
var id = ulong.Parse(ctx.PeekArgument());
|
|
||||||
var guild = await ctx.Cache.TryGetGuild(id);
|
var guild = await ctx.Rest.GetGuildOrNull(id);
|
||||||
if (guild != null)
|
if (guild != null)
|
||||||
ctx.PopArgument();
|
ctx.PopArgument();
|
||||||
|
|
||||||
return guild;
|
return guild;
|
||||||
}
|
}
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user