No need for lambda or function

pull/98/head
bobloy 5 years ago
parent c7dc5eee75
commit e8cdae4c7a

@ -7,7 +7,6 @@ from redbot.core.bot import Red
Cog: Any = getattr(commands, "Cog", object) Cog: Any = getattr(commands, "Cog", object)
listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad
if listener is None: if listener is None:
def listener(name=None): def listener(name=None):
return lambda x: x return lambda x: x
@ -45,9 +44,9 @@ class InfoChannel(Cog):
def check(m): def check(m):
return ( return (
m.content.upper() in ["Y", "YES", "N", "NO"] m.content.upper() in ["Y", "YES", "N", "NO"]
and m.channel == ctx.channel and m.channel == ctx.channel
and m.author == ctx.author and m.author == ctx.author
) )
guild: discord.Guild = ctx.guild guild: discord.Guild = ctx.guild
@ -160,8 +159,10 @@ class InfoChannel(Cog):
onlinecount = guild_data["online_count"] onlinecount = guild_data["online_count"]
# Gets count of bots # Gets count of bots
bots = lambda x: x.bot # bots = lambda x: x.bot
num = len([m for m in guild.members if bots(m)]) # def bots(x): return x.bot
num = len([m for m in guild.members if m.bot])
bot_msg = f"Bots: {num}" bot_msg = f"Bots: {num}"
# Gets count of online users # Gets count of online users
@ -188,8 +189,7 @@ class InfoChannel(Cog):
if guild_data["member_count"]: if guild_data["member_count"]:
name = "{} ".format(human_msg) name = "{} ".format(human_msg)
await channel.edit(reason="InfoChannel update", name=name)
await channel.edit(reason="InfoChannel update", name=name)
if botcount: if botcount:
name = "{} ".format(bot_msg) name = "{} ".format(bot_msg)

Loading…
Cancel
Save