Better Framework, new cog-files

This commit is contained in:
CramMK
2020-01-22 22:29:16 +01:00
parent 2453f84fa2
commit 10c65cfda4
11 changed files with 94 additions and 58 deletions

View File

@@ -29,8 +29,8 @@ The following commands assume that `.` is your default prefix.
There are currently two command, which help the user to naviagte the bot's
commands:
`.aquabot` shows a short introduction
`.help` shows a list of all commands (A custom help message is WIP)
+ `.aquabot` shows a short introduction
+ `.help` shows a list of all commands (A custom help message is WIP)
Config
------

View File

@@ -1,10 +1,9 @@
#################################
### AquaBot created by Marc ###
### Aqua Best Girl! ###
#################################
"""
AquaBot created by Marc.
# This project uses discordpy
# https://discordpy.readthedocs.io/en/latest/intro.html
This project uses discordpy:
https://discordpy.readthedocs.io/en/latest/intro.html
"""
# IMPORTS - external
import discord

View File

@@ -6,6 +6,14 @@
# "load", "unload", "reload"
# https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
#
"""
Admin commands, that can be used from within the chat
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"load", "unload", "reload"
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
"""
# IMPORTS
import discord

20
cogs/anime.py Normal file
View File

@@ -0,0 +1,20 @@
"""
Some anime-related commands
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS
import discord
from discord.ext import commands
# COG INIT
class Adnime(commands.Cog):
def __init__(self, bot):
self.bot = bot
# COG BODY
# COG ENDING
def setup(bot):
bot.add_cog(Adnime(bot))

View File

@@ -1,8 +1,8 @@
#
# foo
#
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
#
"""
This framework can be used to create new Cogs, remember to add them in the config
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS
import discord

View File

@@ -1,8 +1,8 @@
#
# A Cog that add some general commands
#
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
#
"""
Some general commands
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS - external
import discord
@@ -29,24 +29,6 @@ class General(commands.Cog):
await ctx.send(embed=embed)
@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.capitalize() == "Noel":
response = "NNN-GYAAAA!"
else:
response = f"{target} got pat by {author.mention}"
await ctx.send(response)
# COG ENDING
def setup(bot):
bot.add_cog(General(bot))

View File

@@ -1,8 +1,8 @@
#
# Cog for a custom Help Command
#
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
#
"""
Some help for the users
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS - exter
import discord
@@ -23,7 +23,7 @@ class Help(commands.Cog):
I'm the usele... divine AquaBot!
If you need help, try using the `help` command!
"""
await ctx.send(response)

View File

@@ -1,8 +1,8 @@
#
# This Cog adds some utility commands
#
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
#
"""
Some nice utility
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS
import discord
@@ -24,6 +24,24 @@ class Utility(commands.Cog):
link = "Here is our invite link: https://discordapp.com/invite/HbYfyJT"
await ctx.send(link)
@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.capitalize() == "Noel":
response = "NNN-GYAAAA!"
else:
response = f"{target} got pat by {author.mention}"
await ctx.send(response)
# COG ENDING
def setup(bot):
bot.add_cog(Utility(bot))

View File

@@ -1,8 +1,9 @@
#
# A Cog thats deals with welcoming new users etc.
#
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
#
"""
Welcoming new users etc.
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS
import discord

View File

@@ -1,10 +1,14 @@
# Initally loaded cogs
# Don't remove the "admin" cog or tou won't be able to load cogs
# from with the Discord-Client
"""
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.utility"
"cogs.utility",
"cogs.anime"
]

View File

@@ -1,5 +1,9 @@
# Gather all config data into one file
# loadconfig.py then gets called in aquabot.py
"""
Gather all config data into one file
loadconfig.py then gets called in aquabot.py
"""
from config.cogs import __cogs__
from config.config import __token__, __prefix__