blob: 7746c54e1fae7f8f60a9fb514c34c1d95124dca7 (
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
32
33
|
from discord.ext import commands
from . import Bot
class Cog(commands.Cog):
"""A simple discord.py cog."""
def __init__(self, _bot: Bot):
self.bot = _bot
@commands.Cog.listener()
async def on_ready(self) -> None:
"""Print a message when the client (re)connects."""
print("Client is ready.")
@commands.command()
async def reload(self, ctx: commands.Context) -> None:
"""Reload all available cogs."""
message = await ctx.send(":hourglass_flowing_sand: Reloading")
for ext in list(self.bot.extensions):
await self.bot.reload_extension(ext)
await message.edit(content=":white_check_mark: Done")
@commands.command()
async def ping(self, ctx: commands.Context) -> None:
"""Test if the bot is online."""
await ctx.send("We are live!")
async def setup(_bot: Bot) -> None:
"""Install the cog."""
await _bot.add_cog(Cog(_bot))
|