Create structure
This commit creates the first, inital structure for the project.
This commit is contained in:
32
README.md
32
README.md
@@ -1 +1,31 @@
|
|||||||
This is my totally unfinished Discord-Bot using discordpy
|
AquaBot
|
||||||
|
=======
|
||||||
|
|
||||||
|
[](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
|
||||||
|
|||||||
46
aquabot.py
Normal file
46
aquabot.py
Normal file
@@ -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)
|
||||||
0
cogs/__init__.py
Normal file
0
cogs/__init__.py
Normal file
62
cogs/admin.py
Normal file
62
cogs/admin.py
Normal file
@@ -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))
|
||||||
20
cogs/cog_framework.py
Normal file
20
cogs/cog_framework.py
Normal file
@@ -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))
|
||||||
49
cogs/general.py
Normal file
49
cogs/general.py
Normal file
@@ -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))
|
||||||
31
cogs/help.py
Normal file
31
cogs/help.py
Normal file
@@ -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))
|
||||||
36
cogs/welcome.py
Normal file
36
cogs/welcome.py
Normal file
@@ -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))
|
||||||
@@ -187,6 +187,7 @@ async def invite_link(ctx):
|
|||||||
await ctx.send(f"> {response}")
|
await ctx.send(f"> {response}")
|
||||||
|
|
||||||
# Prints an Issei reference
|
# Prints an Issei reference
|
||||||
|
|
||||||
@bot.command()
|
@bot.command()
|
||||||
async def boost(ctx):
|
async def boost(ctx):
|
||||||
response = """
|
response = """
|
||||||
@@ -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
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user