aboutsummaryrefslogtreecommitdiffstats
path: root/dev/bot/cog.py
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2022-07-23 14:47:06 +0200
committerGravatar Hassan Abouelela <[email protected]>2022-07-23 17:10:52 +0200
commitafa46c4abfc73c8791742ed2ece886776823e8ab (patch)
treeb0032b561f63030c61b3174e55f1f0c3ac321b69 /dev/bot/cog.py
parentMark aiodns As An Explicit Dependency (diff)
Add Sample Project With Boilerplate
Adds a bare-bones discord.py bot using features from bot-core, to be used for quickly prototyping and testing out bot-core features. Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'dev/bot/cog.py')
-rw-r--r--dev/bot/cog.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/dev/bot/cog.py b/dev/bot/cog.py
new file mode 100644
index 00000000..7746c54e
--- /dev/null
+++ b/dev/bot/cog.py
@@ -0,0 +1,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))