mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
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:
parent
3d624b39e4
commit
6395872f2d
4 changed files with 39 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue