allow pk;system proxy to take a server ID

So people can disable proxying in a server without outing themselves :)
This commit is contained in:
Mikaela Szekely
2021-04-05 22:25:13 -06:00
parent 3d624b39e4
commit 6395872f2d
4 changed files with 39 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Myriad.Extensions;
using Myriad.Types;
@@ -168,5 +169,22 @@ namespace PluralKit.Bot
ctx.PopArgument();
return channel;
}
public static Guild MatchGuild(this Context ctx)
{
try
{
var id = ulong.Parse(ctx.PeekArgument());
ctx.Cache.TryGetGuild(id, out var guild);
if (guild != null)
ctx.PopArgument();
return guild;
}
catch (FormatException)
{
return null;
}
}
}
}