mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 22:37:54 +00:00
refactor: don't use 'out' in IDiscordCache methods
this change is required for async cache (.NET doesn't support async ref/out params)
This commit is contained in:
parent
3ba46ff456
commit
0efaab6d95
11 changed files with 48 additions and 52 deletions
|
|
@ -157,7 +157,7 @@ namespace PluralKit.Bot
|
|||
if (!MentionUtils.TryParseChannel(ctx.PeekArgument(), out var id))
|
||||
return null;
|
||||
|
||||
if (!await ctx.Cache.TryGetChannel(id, out var channel))
|
||||
if (!(await ctx.Cache.TryGetChannel(id) is Channel channel))
|
||||
return null;
|
||||
|
||||
if (!DiscordUtils.IsValidGuildChannel(channel))
|
||||
|
|
@ -167,12 +167,12 @@ namespace PluralKit.Bot
|
|||
return channel;
|
||||
}
|
||||
|
||||
public static Guild MatchGuild(this Context ctx)
|
||||
public static async Task<Guild> MatchGuild(this Context ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
var id = ulong.Parse(ctx.PeekArgument());
|
||||
ctx.Cache.TryGetGuild(id, out var guild);
|
||||
var guild = await ctx.Cache.TryGetGuild(id);
|
||||
if (guild != null)
|
||||
ctx.PopArgument();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue