diff --git a/README.md b/README.md index 54d0ec6..6713cb9 100644 --- a/README.md +++ b/README.md @@ -1 +1,31 @@ -This is my totally unfinished Discord-Bot using discordpy \ No newline at end of file +AquaBot +======= + +[![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 +here and there. +Also note that this bot is still in its very early stages, so there is no +guaranty that all features work! + +Support and Report requests are handled via Discord (Link above). + +Installation +------------ + +Use `pip install discord.py` 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`. + +Requirements +------------ + +python>=3.6.0 +discord.py>=1.0.0a + + +BIGGER TODOS +------------ ++ Auto-Installing requirements ++ Separate config directory diff --git a/aquabot.py b/aquabot.py new file mode 100644 index 0000000..1d8c68d --- /dev/null +++ b/aquabot.py @@ -0,0 +1,46 @@ +################################# +### AquaBot created by Marc ### +### Aqua Best Girl! ### +################################# + +# This project uses discordpy +# https://discordpy.readthedocs.io/en/latest/intro.html + +# IMPORTS +import discord +from discord.utils import commands + +# CONSTANTS +BOT_TOKEN = "" +COMMAND_PREFIX = "" + +# INIT +bot = commands.Bot(command_prefix=COMMAND_PREFIX, description="Holy Goddess Aqua!") + +inital_extensions = [ + "cogs.admin", + "cogs.general", + "cogs.welcome" + ] + +if __name__ == "__main__": + for extension in inital_extensions: + bot.load_extension(extension) + +# BOT +# https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be +@bot.event +async def on_ready(): + print(f""" + Logged in as: {bot.user.name} - {bot.user.id}\n + Version: {discord.__version__}\n + """) + + status = f"Hentai | {COMMAND_PREFIX}aquabot" + activity = discord.Activity(name=status, type=discord.ActivityType.watching) + await bot.change_presence(activity=activity) + + print(f"AquaBot is ready!\n") + + +bot.run(BOT_TOKEN, bot=True, reconnect=True) diff --git a/cogs/__init__.py b/cogs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cogs/admin.py b/cogs/admin.py new file mode 100644 index 0000000..4f39f9c --- /dev/null +++ b/cogs/admin.py @@ -0,0 +1,62 @@ +# +# A Cog that add admin command, usable within the Discord Client +# +# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html +# +# "load", "unload", "reload" +# https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be +# + +# IMPORTS +import discord +from discord.ext import commands + +# COG INIT +class AdminCog(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 cog_load(self, ctx, *, cog: str): + + try: + self.bot.load_extension(cog) + except Exception as e: + await ctx.send(f'**`ERROR:`** {type(e).__name__} - {e}') + else: + await ctx.send('**`SUCCESS`**') + + + # used as "unload cogs.COGNAME" + @commands.command(name="unload", hidden=True) + @commands.is_owner() + async def cog_unload(self, ctx, *, cog: str): + + try: + self.bot.unload_extension(cog) + except Exception as e: + await ctx.send(f'**`ERROR:`** {type(e).__name__} - {e}') + else: + await ctx.send('**`SUCCESS`**') + + + # used as "reload cogs.COGNAME" + @commands.command(name="reload", hidden=True) + @commands.is_owner() + async def cog_reload(self, ctx, *, cog: str): + + try: + self.bot.unload_extension(cog) + self.bot.load_extension(cog) + except Exception as e: + await ctx.send(f'**`ERROR:`** {type(e).__name__} - {e}') + else: + await ctx.send('**`SUCCESS`**') + + +# COG ENDING +def setup(bot): + bot.add_cog(AdminCog(bot)) diff --git a/cogs/cog_framework.py b/cogs/cog_framework.py new file mode 100644 index 0000000..784a930 --- /dev/null +++ b/cogs/cog_framework.py @@ -0,0 +1,20 @@ +# +# foo +# +# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html +# + +# IMPORTS +import discord +from discord.ext import commands + +# COG INIT +class FooCog(commands.Cog): + def __init__(self, bot): + self.bot = bot + +# COG BODY + +# COG ENDING +def setup(bot): + bot.add_cog(FooCog(bot)) diff --git a/cogs/general.py b/cogs/general.py new file mode 100644 index 0000000..309d390 --- /dev/null +++ b/cogs/general.py @@ -0,0 +1,49 @@ +# +# A Cog that add some general commands +# +# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html +# + +# IMPORTS +import discord +from discord.ext import commands + +# COG INIT +class GeneralCog(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): + + # 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) + + + @commands.command( + name="pat", + description="Pats the selected user" + ) + @commands.guild_only() + async def pat(self, ctx, target: str): + + author = ctx.message.author + if target is None: + response = "No one to pat..." + else if target.capitalize == "Noel": + response = "NNN-GYAAAA!" + else: + response = f"{target.mention} got pat by {author.mention}" + + await ctx.send(response) + + +# COG ENDING +def setup(bot): + bot.add_cog(GeneralCog(bot)) diff --git a/cogs/help.py b/cogs/help.py new file mode 100644 index 0000000..5102e49 --- /dev/null +++ b/cogs/help.py @@ -0,0 +1,31 @@ +# +# Cog for a custom Help Command +# +# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html +# + +# IMPORTS +import discord +from discord.ext import commands + +# COG INIT +class HelpCog(commands.Cog): + def __init__(self, bot): + self.bot = bot + +# COG BODY + @commands.command( + name="aquabot" + description="Prints a short help for new users" + ) + async def aquabot(self, ctx): + + await ctx.send(""" + I'm the usele... divine AquaBot!\n + If you need help, try using the `help` command!\n + """) + + +# COG ENDING +def setup(bot): + bot.add_cog(HelpCog(bot)) diff --git a/cogs/welcome.py b/cogs/welcome.py new file mode 100644 index 0000000..2c4ffa4 --- /dev/null +++ b/cogs/welcome.py @@ -0,0 +1,36 @@ +# +# A Cog thats deals with welcoming new users etc. +# +# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html +# + +# IMPORTS +import discord +from discord.ext import commands + +# COG INIT +class WelcomeCog(commands.Cog): + def __init__(self, bot): + self.bot = bot + +# COG BODY + @commands.Cog.listener() + async def on_member_join(self, member): + + 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!" + ) + async def hello(self, ctx): + + await ctx.send(f"Hello {ctx.author}!") + +# COG ENDING +def setup(bot): + bot.add_cog(WelcomeCog(bot)) diff --git a/src/aquabot_old.py b/old/aquabot_old.py similarity index 100% rename from src/aquabot_old.py rename to old/aquabot_old.py diff --git a/src/aquabot_revamp.py b/old/aquabot_revamp.py similarity index 99% rename from src/aquabot_revamp.py rename to old/aquabot_revamp.py index 334d0cf..eb5c027 100644 --- a/src/aquabot_revamp.py +++ b/old/aquabot_revamp.py @@ -187,6 +187,7 @@ async def invite_link(ctx): await ctx.send(f"> {response}") # Prints an Issei reference + @bot.command() async def boost(ctx): response = """ @@ -225,4 +226,4 @@ async def flame(ctx, username): ###################### ### Media Commands ### -###################### \ No newline at end of file +###################### diff --git a/src/aquabot.py b/src/aquabot.py deleted file mode 100644 index 16bf287..0000000 --- a/src/aquabot.py +++ /dev/null @@ -1,10 +0,0 @@ -################################# -### AquaBot created by Marc ### -### Project started ### -### on 17.09.2019 ### -### Aqua Best Girl! ### -################################# - -# This project uses discordpy -# https://discordpy.readthedocs.io/en/latest/intro.html -