mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
Fix Build Errors
This commit is contained in:
parent
23cf06df4c
commit
c99784b9dc
19 changed files with 301 additions and 136 deletions
23
PluralKit.Bot/Extensions.cs
Normal file
23
PluralKit.Bot/Extensions.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using DSharpPlus;
|
||||
|
||||
using System.Net.WebSockets;
|
||||
|
||||
namespace PluralKit.Bot
|
||||
{
|
||||
static class Extensions
|
||||
{
|
||||
//Unfortunately D#+ doesn't expose the connection state of the client, so we have to test for it instead
|
||||
public static bool IsConnected(this DiscordClient client)
|
||||
{
|
||||
try
|
||||
{
|
||||
client.GetConnectionsAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
catch(WebSocketException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue