aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/free.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/cogs/free.py b/bot/cogs/free.py
index 167fab319..ec8834240 100644
--- a/bot/cogs/free.py
+++ b/bot/cogs/free.py
@@ -7,7 +7,6 @@ from discord.ext.commands import Bot, Cog, Context, command
from bot.constants import Categories, Channels, Free, STAFF_ROLES
from bot.decorators import redirect_output
-
log = logging.getLogger(__name__)
TIMEOUT = Free.activity_timeout
@@ -51,10 +50,10 @@ class Free(Cog):
# the command was invoked in
if channel.id == ctx.channel.id:
messages = await channel.history(limit=seek).flatten()
- msg = messages[seek-1]
+ msg = messages[seek - 1]
# Otherwise get last message
else:
- msg = await channel.history(limit=1).next() # noqa (False positive)
+ msg = await channel.history(limit=1).next() # noqa (False positive)
inactive = (datetime.utcnow() - msg.created_at).seconds
if inactive > TIMEOUT:
@@ -80,7 +79,8 @@ class Free(Cog):
# 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):
+ for i, (inactive, channel) in enumerate(
+ sorted(free_channels, key=lambda free_channel: free_channel[0], reverse=True), 1):
minutes, seconds = divmod(inactive, 60)
if minutes > 59:
hours, minutes = divmod(minutes, 60)