diff --git a/.gitignore b/.gitignore index f3ca72f..a512256 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__/ -config/config.py \ No newline at end of file +config/config.py +.vscode/ \ No newline at end of file diff --git a/README.md b/README.md index 4ff7cd6..66392e7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ ![Avatar](img/avatar.png) - -AquaBot +![Slogan](img/aquabot.png) ======= -[![discordpy](https://img.shields.io/badge/python-3.7-blue.svg)](https://github.com/Rapptz/discord.py) +[![discordpy](https://img.shields.io/badge/discordpy-Core-blue)](https://github.com/Rapptz/discord.py) [![Discord Server](https://img.shields.io/badge/Support-Discord%20Server-blue.svg)](https://discordapp.com/invite/HbYfyJT) This bot is my first personal project so expect some minor (or bigger) problems @@ -16,11 +15,16 @@ Support and Report requests are handled via Discord (Link above). Installation ------------ -Use `pip install discord.py` to install the latest version of discord.py. +Use `pip install discord.py[voice]` to install the latest version of discord.py. Then, after cloning this repository with `git clone https://github.com/crammk/aquabot`, you can run the `aquabot.py`. +Commands +------ + +# TODO + Config ------ diff --git a/cogs/admin.py b/cogs/admin.py index 4263077..37530a8 100644 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -12,16 +12,17 @@ import discord from discord.ext import commands # COG INIT -class AdminCog(commands.Cog): +class Admin(commands.Cog): def __init__(self, bot): self.bot = bot # COG BODY - # used as "load cogs.COGNAME" @commands.command(name="load", hidden=True) @commands.is_owner() async def load(self, ctx, *, cog: str): - + """ + Used as 'load cogs.COGNAME' + """ try: self.bot.load_extension(cog) except Exception as e: @@ -30,11 +31,12 @@ class AdminCog(commands.Cog): await ctx.send('**`SUCCESS`**') - # used as "unload cogs.COGNAME" @commands.command(name="unload", hidden=True) @commands.is_owner() async def unload(self, ctx, *, cog: str): - + """ + Used as 'unload cogs.COGNAME' + """ try: self.bot.unload_extension(cog) except Exception as e: @@ -43,11 +45,12 @@ class AdminCog(commands.Cog): await ctx.send('**`SUCCESS`**') - # used as "reload cogs.COGNAME" @commands.command(name="reload", hidden=True) @commands.is_owner() async def reload(self, ctx, *, cog: str): - + """ + Used as 'reload cogs.COGNAME' + """ try: self.bot.unload_extension(cog) self.bot.load_extension(cog) @@ -59,4 +62,4 @@ class AdminCog(commands.Cog): # COG ENDING def setup(bot): - bot.add_cog(AdminCog(bot)) \ No newline at end of file + bot.add_cog(Admin(bot)) \ No newline at end of file diff --git a/cogs/cog_framework.py b/cogs/cog_framework.py index 784a930..d95319a 100644 --- a/cogs/cog_framework.py +++ b/cogs/cog_framework.py @@ -9,7 +9,7 @@ import discord from discord.ext import commands # COG INIT -class FooCog(commands.Cog): +class Foo(commands.Cog): def __init__(self, bot): self.bot = bot @@ -17,4 +17,4 @@ class FooCog(commands.Cog): # COG ENDING def setup(bot): - bot.add_cog(FooCog(bot)) + bot.add_cog(Foo(bot)) \ No newline at end of file diff --git a/cogs/general.py b/cogs/general.py index 2420245..621c61e 100644 --- a/cogs/general.py +++ b/cogs/general.py @@ -4,46 +4,49 @@ # https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html # -# IMPORTS +# IMPORTS - external import discord from discord.ext import commands # COG INIT -class GeneralCog(commands.Cog): +class General(commands.Cog): def __init__(self, bot): self.bot = bot # COG BODY - @commands.command( - name="invitelink", - description="Sends the invite link", - aliases=["invite"] - ) - async def invite_link(self, ctx): + @commands.command(name="about") + async def about(self, ctx): + """ + Prints some information about myself + """ + embed = discord.Embed(colour=discord.Colour.blue()) - # TODO fetch this from config so more servers are supported - link = "Here is our invite link: https://discordapp.com/invite/HbYfyJT" - await ctx.send(link) + embed.add_field(name="test", value="test2") + + embed.set_footer(text="footer", icon_url="img/avatar.png") + + + await ctx.send(embed=embed) - @commands.command( - name="pat", - description="Pats the selected user" - ) + + @commands.command(name="pat") @commands.guild_only() async def pat(self, ctx, target: str): - + """ + Let's you pat a selected user + """ author = ctx.message.author if target is None: response = "No one to pat..." - elif target == "Noel": + elif target.capitalize() == "Noel": response = "NNN-GYAAAA!" else: - response = f"{target.mention} got pat by {author.mention}" + response = f"{target} got pat by {author.mention}" await ctx.send(response) # COG ENDING def setup(bot): - bot.add_cog(GeneralCog(bot)) \ No newline at end of file + bot.add_cog(General(bot)) \ No newline at end of file diff --git a/cogs/help.py b/cogs/help.py index db64174..b700374 100644 --- a/cogs/help.py +++ b/cogs/help.py @@ -9,23 +9,24 @@ import discord from discord.ext import commands # COG INIT -class HelpCog(commands.Cog): +class Help(commands.Cog): def __init__(self, bot): self.bot = bot # COG BODY - @commands.command( - name="aquabot", - description="Prints a short help for new users" - ) + @commands.command( name="aquabot") async def aquabot(self, ctx): + """ + Sends a short help for new users + """ + response = """ + I'm the usele... divine AquaBot! + If you need help, try using the `help` command! + """ - await ctx.send(""" - I'm the usele... divine AquaBot! - If you need help, try using the `help` command! - """) + await ctx.send(response) # COG ENDING def setup(bot): - bot.add_cog(HelpCog(bot)) \ No newline at end of file + bot.add_cog(Help(bot)) \ No newline at end of file diff --git a/cogs/utility.py b/cogs/utility.py new file mode 100644 index 0000000..5a0c595 --- /dev/null +++ b/cogs/utility.py @@ -0,0 +1,29 @@ +# +# This Cog adds some utility commands +# +# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html +# + +# IMPORTS +import discord +from discord.ext import commands + +# COG INIT +class Utility(commands.Cog): + def __init__(self, bot): + self.bot = bot + +# COG BODY + @commands.command(name="invitelink", aliases=["invite"]) + async def invite_link(self, ctx): + """ + Sends the server's invitelink to chat + """ + + # TODO fetch this from config so more servers are supported + link = "Here is our invite link: https://discordapp.com/invite/HbYfyJT" + await ctx.send(link) + +# COG ENDING +def setup(bot): + bot.add_cog(Utility(bot)) diff --git a/cogs/welcome.py b/cogs/welcome.py index 039416e..b9e7051 100644 --- a/cogs/welcome.py +++ b/cogs/welcome.py @@ -9,28 +9,27 @@ import discord from discord.ext import commands # COG INIT -class WelcomeCog(commands.Cog): +class Welcome(commands.Cog): def __init__(self, bot): self.bot = bot # COG BODY @commands.Cog.listener() async def on_member_join(self, member): - + """ + Greets new users joining your server + """ channel = member.guild.system_channel text = f"Welcome {member.mention} to our useless Discord!" if channel is not None: await channel.send(text) - @commands.command( - name="hello", - description="Hello!" - ) + @commands.command(name="hello") async def hello(self, ctx): await ctx.send(f"Hello {ctx.author.mention}!") # COG ENDING def setup(bot): - bot.add_cog(WelcomeCog(bot)) \ No newline at end of file + bot.add_cog(Welcome(bot)) \ No newline at end of file diff --git a/config/cogs.py b/config/cogs.py index b5dc9fa..05c5f2e 100644 --- a/config/cogs.py +++ b/config/cogs.py @@ -1,7 +1,10 @@ # Initally loaded cogs +# Don't remove the "admin" cog or tou won't be able to load cogs +# from with the Discord-Client __cogs__ = [ "cogs.admin", "cogs.general", "cogs.welcome", - "cogs.help" + "cogs.help", + "cogs.utility" ] \ No newline at end of file diff --git a/img/aquabot.png b/img/aquabot.png new file mode 100644 index 0000000..c8ff943 Binary files /dev/null and b/img/aquabot.png differ