diff options
| author | 2019-01-09 18:36:57 -0500 | |
|---|---|---|
| committer | 2019-01-09 18:36:57 -0500 | |
| commit | 4313a9c5ed6b052d46f00350b10a8c3d62136c48 (patch) | |
| tree | be0a0b5c3e4dffa509612d83ab4ab7c2025af83e | |
| parent | Change line to fit prevailing style (diff) | |
Add all the block comments!
| -rw-r--r-- | bot/cogs/free.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bot/cogs/free.py b/bot/cogs/free.py index 6f0e86330..0880cdd25 100644 --- a/bot/cogs/free.py +++ b/bot/cogs/free.py @@ -43,10 +43,15 @@ class Free: elif not 0 < seek < 10: seek = 3 + # Iterate through all the help channels + # to check latest activity for channel in python_help.channels: + # Seek further back in the help channel + # the command was invoked in if channel.id == ctx.channel.id: messages = await channel.history(limit=seek).flatten() msg = messages[seek-1] + # Otherwise get last message else: msg = await channel.history(limit=1).next() # noqa (False positive) @@ -63,12 +68,17 @@ class Free: else: embed.description = "" + # Display all potentially inactive channels + # in descending order of inactivity if free_channels: embed.description += "**The following channel{0} look{1} free:**\n\n**".format( 's' if len(free_channels) > 1 else '', '' if len(free_channels) > 1 else 's' ) + # Sort channels in descending order by seconds + # Get position in list, inactivity, and channel object + # For each channel, add to embed.description for i, (inactive, channel) in enumerate(sorted(free_channels, reverse=True), 1): minutes, seconds = divmod(inactive, 60) if minutes > 59: |