Class GatewayClientExtensions
Entry points for enabling and accessing Nyra on NetCord clients.
public static class GatewayClientExtensions
- Inheritance
-
GatewayClientExtensions
- Inherited Members
Methods
GetNyra(GatewayClient)
Gets the Nyra extension of the client, or null when Nyra is not enabled.
public static NyraExtension? GetNyra(this GatewayClient client)
Parameters
clientGatewayClientThe client to read the extension of.
Returns
- NyraExtension
The extension of the client, null when Nyra is not enabled.
GetNyra(ShardedGatewayClient)
Gets the Nyra extension of the sharded client, or null when Nyra is not enabled.
public static NyraExtension? GetNyra(this ShardedGatewayClient client)
Parameters
clientShardedGatewayClientThe sharded client to read the extension of.
Returns
- NyraExtension
The extension of the sharded client, null when Nyra is not enabled.
UseNyra(GatewayClient, ILogger?)
Enables Nyra on the client.
public static NyraExtension UseNyra(this GatewayClient client, ILogger? logger = null)
Parameters
clientGatewayClientThe client to enable Nyra on.
loggerILoggerThe logger to write the bridge's messages to.
Returns
- NyraExtension
The enabled extension, the existing one when Nyra is already on. The logger of the first enabling is the one the extension keeps for its lifetime, the logger of a later call is ignored unless the earlier extension was disposed.
Remarks
NetCord logs through its own logger, configured only at client creation, so pass a logger here to receive Nyra's log messages. Enable it on a live client, since one already disposed accepts the subscription silently and every later connect waits out the sixty-second gateway timeout with a cause that blames the gateway.
Voice connections need the guilds and guild voice states intents. Without the guilds intent a kick leaves a zombie no guild delete reports, and without voice states every join times out waiting for its own state update.
NetCord exposes no way to read the configured intents at runtime, so Nyra cannot warn about a missing one the way the DSharpPlus adapter does, verify them in the client's configuration.
UseNyra(ShardedGatewayClient, ILogger?)
Enables Nyra on the sharded client.
public static NyraExtension UseNyra(this ShardedGatewayClient client, ILogger? logger = null)
Parameters
clientShardedGatewayClientThe sharded client to enable Nyra on, one extension covering every shard.
loggerILoggerThe logger to write the bridge's messages to.
Returns
- NyraExtension
The enabled extension, the existing one when Nyra is already on. The logger of the first enabling is the one the extension keeps for its lifetime, the logger of a later call is ignored unless the earlier extension was disposed.
Remarks
NetCord logs through its own logger, configured only at client creation, so pass a logger here to receive Nyra's log messages. A disposed sharded client rejects the subscription at the first event subscription with the library's own ObjectDisposedException, unlike the single client, which accepts it silently and waits out the gateway timeout.
Voice connections need the guilds and guild voice states intents, see the remarks of the single-client UseNyra(GatewayClient, ILogger?) for the failure modes and why Nyra cannot verify them at runtime.