aboutsummaryrefslogtreecommitdiffstats
path: root/bot/cogs/template.py
diff options
context:
space:
mode:
authorGravatar Marko Kovačević <[email protected]>2018-10-02 22:08:29 +0200
committerGravatar Marko Kovačević <[email protected]>2018-10-02 22:08:29 +0200
commitc0436c8a1e6240bae819b82f1237529b3170a74c (patch)
treef2cff20852fe55689adc2dd1d3eb0d75d3982029 /bot/cogs/template.py
parentFix wrongful indentation. (diff)
Add some comments and docstrings documenting the code and replacing minor issues.
Diffstat (limited to 'bot/cogs/template.py')
-rw-r--r--bot/cogs/template.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/bot/cogs/template.py b/bot/cogs/template.py
index 18b3f21c..da92f6b5 100644
--- a/bot/cogs/template.py
+++ b/bot/cogs/template.py
@@ -1,14 +1,31 @@
+from os import system
+
+
from discord.ext import commands
+"""A template cog that contains examples of commands and command groups."""
+
+
class Template:
def __init__(self, bot):
self.bot = bot
-
- @commands.command()
- async def template(self, ctx):
- await ctx.send('It indeed is a template cog!')
-
+ @commands.command(name='repo', aliases=['repository', 'project'], brief='A link to the repository of this bot.')
+ async def repository(self, ctx):
+ await ctx.send('https://github.com/discord-python/hacktoberbot')
+
+ # A command group with the name git. You can now create sub-commands such as git commit.
+ @commands.group(name='git', invoke_without_command=True)
+ async def github(self, ctx):
+ await ctx.send('Resources to learn **Git**: https://try.github.io/.')
+
+ # A command that belongs to the git command group. Invoked using git commit.
+ @github.command()
+ async def commit(self, ctx):
+ system('git commit -m "A huge commit adding many revolutionary features!"')
+
+
+# Required in order to load the cog, use the class name in the add_cog function.
def setup(bot):
bot.add_cog(Template(bot))