[General] Add shard ID to serverinfo if bot uses multiple shards (#3659)

* [General] Add shard ID on serverinfo if there is over than two shards

* Update general.py

* Update general.py

* Update general.py

* Update general.py
This commit is contained in:
PredaaA 2020-03-16 01:42:35 +01:00 committed by GitHub
parent 6128d54601
commit 4de7ce32dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,6 +289,14 @@ class General(commands.Cog):
num /= 1000.0 num /= 1000.0
return "{0:.1f}{1}".format(num, "YB") return "{0:.1f}{1}".format(num, "YB")
shard_info = (
_("\nShard ID: **{shard_id}/{shard_count}**").format(
shard_id=humanize_number(guild.shard_id + 1),
shard_count=humanize_number(ctx.bot.shard_count),
)
if ctx.bot.shard_count > 1
else ""
)
# Logic from: https://github.com/TrustyJAID/Trusty-cogs/blob/master/serverstats/serverstats.py#L159 # Logic from: https://github.com/TrustyJAID/Trusty-cogs/blob/master/serverstats/serverstats.py#L159
online_stats = { online_stats = {
_("Humans: "): lambda x: not x.bot, _("Humans: "): lambda x: not x.bot,
@ -403,12 +411,13 @@ class General(commands.Cog):
data.add_field( data.add_field(
name=_("Utility:"), name=_("Utility:"),
value=_( value=_(
"Owner: {owner}\nVoice region: {region}\nVerif. level: {verif}\nServer ID: {id}" "Owner: {owner}\nVoice region: {region}\nVerif. level: {verif}\nServer ID: {id}{shard_info}"
).format( ).format(
owner=bold(str(guild.owner)), owner=bold(str(guild.owner)),
region=f"**{vc_regions.get(str(guild.region)) or str(guild.region)}**", region=f"**{vc_regions.get(str(guild.region)) or str(guild.region)}**",
verif=bold(verif[str(guild.verification_level)]), verif=bold(verif[str(guild.verification_level)]),
id=bold(str(guild.id)), id=bold(str(guild.id)),
shard_info=shard_info,
), ),
inline=False, inline=False,
) )