#Sharding Ping and Id

1 messages · Page 1 of 1 (latest)

void siren
#

Because it's giving the error: "System.NullReferenceException: Object reference not set to an instance of an object.
at Violet.commands.CommonCommands.Ping(CommandContext ctx) in /home/kyorem/Documentos/Projects/Violet/commands/CommonCommands.cs:line 24" when I use the command? I wanted to get the ID and Ping of the shard that the user used the command.

stark crescent
#

i have no idea what your sharding context does

#

simply use ctx.client

#

also guild can be null in case of dms

void siren
hollow loomBOT
#

DSharpPlus.CommandsNext.CommandContext.Client

Summary

Gets the client which received the message.

Declaration

public DiscordClient Client { get; internal set; }
stark crescent
#

it should have that method

#

im confused w8 a sec

#

so you updated to nightlies?

hollow loomBOT
#

DSharpPlus.Utilities.GetShardId

Summary

Gets a shard id from a guild id and total shard count.

Declaration

public static int GetShardId
(
	ulong guildId,
	int shardCount
);
stark crescent
#

and

hollow loomBOT
#

DSharpPlus.DiscordClient.GetConnectionLatency

Summary

Gets the latency in the connection to a specific guild.

Declaration

public TimeSpan GetConnectionLatency
(
	ulong guildId
);
pallid oracle
# void siren ?

in versions before roughly 5.0.0-nightly-2300 the client represented one shard

#

you were automatically given the current shard

#

in versions after that, use what plerx linked

void siren
hollow loomBOT
#

DSharpPlus.Clients.IShardOrchestrator.GetConnectionLatency

Summary

Gets the connection latency to a specific guild, otherwise known as ping.

Declaration

public abstract TimeSpan GetConnectionLatency
(
	ulong guildId
);
void siren
# stark crescent and

This function to get the latency of the shard on the server didn't work, it didn't appear for me, I'm using the standard version 5.0.0.

stark crescent
#

standard version 5?

#

the nightlies have a suffix with a number

void siren
pallid oracle
#

there is no "standard version 5", typing 5.0.0 as a version string will restore, but it'll also not resolve to a version you want

#

you need to be on nightly builds