blob: b23c65a42cb7d7b82b6bec9d163a700c0b45d931 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import logging
from discord.ext import commands
log = logging.getLogger(__name__)
class LemonStats(commands.Cog):
"""A cog for generating useful lemon-related statistics."""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def lemoncount(self, ctx: commands.Context):
"""Count the number of users on the server with `'lemon'` in their nickname."""
async with ctx.typing():
lemoncount = sum(
['lemon' in server_member.display_name.lower() for server_member in self.bot.guilds[0].members]
)
await ctx.send(f"There are currently {lemoncount} lemons on the server.")
def setup(bot):
"""Load LemonStats Cog."""
bot.add_cog(LemonStats(bot))
log.info("LemonStats cog loaded")
|