mirror of
https://github.com/NoiTheCat/WorldTime.git
synced 2024-11-24 01:14:13 +00:00
Change prefix in user display for better readability
This commit is contained in:
parent
5cb898cd06
commit
dc26f56221
1 changed files with 5 additions and 6 deletions
11
commands.py
11
commands.py
|
@ -50,15 +50,14 @@ class WtCommands:
|
||||||
list entry, describing the users for which a zone is represented by.
|
list entry, describing the users for which a zone is represented by.
|
||||||
"""
|
"""
|
||||||
if len(userIds) == 0:
|
if len(userIds) == 0:
|
||||||
return " -- Representing 0 users. Bug?"
|
return " → This text should never appear."
|
||||||
|
|
||||||
# Try given entries. For each entry tried, attempt to get their nickname
|
# Try given entries. For each entry tried, attempt to get their nickname
|
||||||
# or username. Failed attempts are anonymized instead of discarded.
|
# or username. Failed attempts are anonymized instead of discarded.
|
||||||
# Attempt at most three entries.
|
|
||||||
namesProcessed = 0
|
namesProcessed = 0
|
||||||
namesSkipped = 0
|
namesSkipped = 0
|
||||||
processedNames = []
|
processedNames = []
|
||||||
while namesProcessed < 3 and len(userIds) > 0:
|
while namesProcessed < 4 and len(userIds) > 0:
|
||||||
namesProcessed += 1
|
namesProcessed += 1
|
||||||
uid = userIds.pop()
|
uid = userIds.pop()
|
||||||
mem = guild.get_member(int(uid))
|
mem = guild.get_member(int(uid))
|
||||||
|
@ -68,12 +67,12 @@ class WtCommands:
|
||||||
namesSkipped += 1
|
namesSkipped += 1
|
||||||
leftovers = namesSkipped + len(userIds)
|
leftovers = namesSkipped + len(userIds)
|
||||||
if len(processedNames) == 0:
|
if len(processedNames) == 0:
|
||||||
return " -- Representing {0} user{1}.".format(leftovers, "s" if leftovers != 1 else "")
|
return " → {0} user{1}.".format(leftovers, "s" if leftovers != 1 else "")
|
||||||
result = " -- Representing "
|
result = " → "
|
||||||
while len(processedNames) > 0:
|
while len(processedNames) > 0:
|
||||||
result += processedNames.pop() + ", "
|
result += processedNames.pop() + ", "
|
||||||
if leftovers != 0:
|
if leftovers != 0:
|
||||||
result += "{0} other user{1}.".format(leftovers, "s" if leftovers != 1 else "")
|
result += "{0} other{1}.".format(leftovers, "s" if leftovers != 1 else "")
|
||||||
else:
|
else:
|
||||||
result = result[:-2] + "."
|
result = result[:-2] + "."
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in a new issue