Skip to content

Commit

Permalink
Improve area information retrieval on discord
Browse files Browse the repository at this point in the history
- Renames getareas to gethubs
- Message splitting when character limit is reached
  • Loading branch information
axestyra authored Jul 16, 2024
1 parent 23dc4c4 commit 8fff576
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/discordbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def announcing(ctx, name=None, description=None, url=None, additional=None
await channel.send(embed=embed)

@self.command()
async def getareas(ctx):
async def gethubs(ctx):
msg = ""
number_players = int(self.server.player_count)
msg += f"**Clients in Areas**\n"
Expand Down Expand Up @@ -112,7 +112,9 @@ async def getareas(ctx):
msg += "\n"
msg += f"Current online: {number_players} clients\n"
if len(msg) > 2000:
await ctx.send(f"Current online: {number_players} clients\nArea information hidden due to char limit.")
msgchunks = [msg[i:i+2000] for i in range(0, len(msg), 2000)]
for chunk in msgchunks:
await ctx.send(chunk)
else:
await ctx.send(msg)

Expand Down

0 comments on commit 8fff576

Please sign in to comment.