diff options
| author | 2018-10-03 20:45:54 +0200 | |
|---|---|---|
| committer | 2018-10-03 20:45:54 +0200 | |
| commit | 9a81988267408f3ca4c23083c9a4b771d6dc3d5f (patch) | |
| tree | e16aae5974f0dd8eba556cc818d689ac170f309a /bot/cogs | |
| parent | Create CONTRIBUTING.md (diff) | |
| parent | Use docstrings instead of block comments. (diff) | |
Merge pull request #2 from markylon/master
Set up some simple Discord bot boilerplate.
Diffstat (limited to 'bot/cogs')
| -rw-r--r-- | bot/cogs/template.py | 36 | 
1 files changed, 36 insertions, 0 deletions
| diff --git a/bot/cogs/template.py b/bot/cogs/template.py new file mode 100644 index 00000000..89f12fe1 --- /dev/null +++ b/bot/cogs/template.py @@ -0,0 +1,36 @@ +from discord.ext import commands + + +class Template: + +    """ +    A template cog that contains examples of commands and command groups. +    """ + +    def __init__(self, bot): +        self.bot = bot + +    @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') + +    @commands.group(name='git', invoke_without_command=True) +    async def github(self, ctx): +        """ +        A command group with the name git. You can now create sub-commands such as git commit. +        """ + +        await ctx.send('Resources to learn **Git**: https://try.github.io/.') + +    @github.command() +    async def commit(self, ctx): +        """ +        A command that belongs to the git command group. Invoked using git commit. +        """ + +        await ctx.send('`git commit -m "First commit"` commits tracked changes.') + + +# Required in order to load the cog, use the class name in the add_cog function. +def setup(bot): +    bot.add_cog(Template(bot)) | 
