Add AquaBot title
and some other minor changes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
config/config.py
|
config/config.py
|
||||||
|
.vscode/
|
||||||
12
README.md
12
README.md
@@ -1,9 +1,8 @@
|
|||||||

|

|
||||||
|

|
||||||
AquaBot
|
|
||||||
=======
|
=======
|
||||||
|
|
||||||
[](https://github.com/Rapptz/discord.py)
|
[](https://github.com/Rapptz/discord.py)
|
||||||
[](https://discordapp.com/invite/HbYfyJT)
|
[](https://discordapp.com/invite/HbYfyJT)
|
||||||
|
|
||||||
This bot is my first personal project so expect some minor (or bigger) problems
|
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
|
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
|
Then, after cloning this repository with
|
||||||
`git clone https://github.com/crammk/aquabot`, you can run the `aquabot.py`.
|
`git clone https://github.com/crammk/aquabot`, you can run the `aquabot.py`.
|
||||||
|
|
||||||
|
Commands
|
||||||
|
------
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
|
||||||
Config
|
Config
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import discord
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class AdminCog(commands.Cog):
|
class Admin(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
# COG BODY
|
# COG BODY
|
||||||
# used as "load cogs.COGNAME"
|
|
||||||
@commands.command(name="load", hidden=True)
|
@commands.command(name="load", hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def load(self, ctx, *, cog: str):
|
async def load(self, ctx, *, cog: str):
|
||||||
|
"""
|
||||||
|
Used as 'load cogs.COGNAME'
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self.bot.load_extension(cog)
|
self.bot.load_extension(cog)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -30,11 +31,12 @@ class AdminCog(commands.Cog):
|
|||||||
await ctx.send('**`SUCCESS`**')
|
await ctx.send('**`SUCCESS`**')
|
||||||
|
|
||||||
|
|
||||||
# used as "unload cogs.COGNAME"
|
|
||||||
@commands.command(name="unload", hidden=True)
|
@commands.command(name="unload", hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def unload(self, ctx, *, cog: str):
|
async def unload(self, ctx, *, cog: str):
|
||||||
|
"""
|
||||||
|
Used as 'unload cogs.COGNAME'
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self.bot.unload_extension(cog)
|
self.bot.unload_extension(cog)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -43,11 +45,12 @@ class AdminCog(commands.Cog):
|
|||||||
await ctx.send('**`SUCCESS`**')
|
await ctx.send('**`SUCCESS`**')
|
||||||
|
|
||||||
|
|
||||||
# used as "reload cogs.COGNAME"
|
|
||||||
@commands.command(name="reload", hidden=True)
|
@commands.command(name="reload", hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def reload(self, ctx, *, cog: str):
|
async def reload(self, ctx, *, cog: str):
|
||||||
|
"""
|
||||||
|
Used as 'reload cogs.COGNAME'
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self.bot.unload_extension(cog)
|
self.bot.unload_extension(cog)
|
||||||
self.bot.load_extension(cog)
|
self.bot.load_extension(cog)
|
||||||
@@ -59,4 +62,4 @@ class AdminCog(commands.Cog):
|
|||||||
|
|
||||||
# COG ENDING
|
# COG ENDING
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(AdminCog(bot))
|
bot.add_cog(Admin(bot))
|
||||||
@@ -9,7 +9,7 @@ import discord
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class FooCog(commands.Cog):
|
class Foo(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@@ -17,4 +17,4 @@ class FooCog(commands.Cog):
|
|||||||
|
|
||||||
# COG ENDING
|
# COG ENDING
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(FooCog(bot))
|
bot.add_cog(Foo(bot))
|
||||||
@@ -4,46 +4,49 @@
|
|||||||
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
|
# https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
|
||||||
#
|
#
|
||||||
|
|
||||||
# IMPORTS
|
# IMPORTS - external
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class GeneralCog(commands.Cog):
|
class General(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
# COG BODY
|
# COG BODY
|
||||||
@commands.command(
|
@commands.command(name="about")
|
||||||
name="invitelink",
|
async def about(self, ctx):
|
||||||
description="Sends the invite link",
|
"""
|
||||||
aliases=["invite"]
|
Prints some information about myself
|
||||||
)
|
"""
|
||||||
async def invite_link(self, ctx):
|
embed = discord.Embed(colour=discord.Colour.blue())
|
||||||
|
|
||||||
# TODO fetch this from config so more servers are supported
|
embed.add_field(name="test", value="test2")
|
||||||
link = "Here is our invite link: https://discordapp.com/invite/HbYfyJT"
|
|
||||||
await ctx.send(link)
|
embed.set_footer(text="footer", icon_url="img/avatar.png")
|
||||||
|
|
||||||
|
|
||||||
@commands.command(
|
await ctx.send(embed=embed)
|
||||||
name="pat",
|
|
||||||
description="Pats the selected user"
|
|
||||||
)
|
|
||||||
|
@commands.command(name="pat")
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def pat(self, ctx, target: str):
|
async def pat(self, ctx, target: str):
|
||||||
|
"""
|
||||||
|
Let's you pat a selected user
|
||||||
|
"""
|
||||||
author = ctx.message.author
|
author = ctx.message.author
|
||||||
if target is None:
|
if target is None:
|
||||||
response = "No one to pat..."
|
response = "No one to pat..."
|
||||||
elif target == "Noel":
|
elif target.capitalize() == "Noel":
|
||||||
response = "NNN-GYAAAA!"
|
response = "NNN-GYAAAA!"
|
||||||
else:
|
else:
|
||||||
response = f"{target.mention} got pat by {author.mention}"
|
response = f"{target} got pat by {author.mention}"
|
||||||
|
|
||||||
await ctx.send(response)
|
await ctx.send(response)
|
||||||
|
|
||||||
|
|
||||||
# COG ENDING
|
# COG ENDING
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(GeneralCog(bot))
|
bot.add_cog(General(bot))
|
||||||
21
cogs/help.py
21
cogs/help.py
@@ -9,23 +9,24 @@ import discord
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class HelpCog(commands.Cog):
|
class Help(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
# COG BODY
|
# COG BODY
|
||||||
@commands.command(
|
@commands.command( name="aquabot")
|
||||||
name="aquabot",
|
|
||||||
description="Prints a short help for new users"
|
|
||||||
)
|
|
||||||
async def aquabot(self, ctx):
|
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("""
|
await ctx.send(response)
|
||||||
I'm the usele... divine AquaBot!
|
|
||||||
If you need help, try using the `help` command!
|
|
||||||
""")
|
|
||||||
|
|
||||||
|
|
||||||
# COG ENDING
|
# COG ENDING
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(HelpCog(bot))
|
bot.add_cog(Help(bot))
|
||||||
29
cogs/utility.py
Normal file
29
cogs/utility.py
Normal file
@@ -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))
|
||||||
@@ -9,28 +9,27 @@ import discord
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class WelcomeCog(commands.Cog):
|
class Welcome(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
# COG BODY
|
# COG BODY
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_member_join(self, member):
|
async def on_member_join(self, member):
|
||||||
|
"""
|
||||||
|
Greets new users joining your server
|
||||||
|
"""
|
||||||
channel = member.guild.system_channel
|
channel = member.guild.system_channel
|
||||||
text = f"Welcome {member.mention} to our useless Discord!"
|
text = f"Welcome {member.mention} to our useless Discord!"
|
||||||
if channel is not None:
|
if channel is not None:
|
||||||
await channel.send(text)
|
await channel.send(text)
|
||||||
|
|
||||||
|
|
||||||
@commands.command(
|
@commands.command(name="hello")
|
||||||
name="hello",
|
|
||||||
description="Hello!"
|
|
||||||
)
|
|
||||||
async def hello(self, ctx):
|
async def hello(self, ctx):
|
||||||
|
|
||||||
await ctx.send(f"Hello {ctx.author.mention}!")
|
await ctx.send(f"Hello {ctx.author.mention}!")
|
||||||
|
|
||||||
# COG ENDING
|
# COG ENDING
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(WelcomeCog(bot))
|
bot.add_cog(Welcome(bot))
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
# Initally loaded cogs
|
# 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__ = [
|
||||||
"cogs.admin",
|
"cogs.admin",
|
||||||
"cogs.general",
|
"cogs.general",
|
||||||
"cogs.welcome",
|
"cogs.welcome",
|
||||||
"cogs.help"
|
"cogs.help",
|
||||||
|
"cogs.utility"
|
||||||
]
|
]
|
||||||
BIN
img/aquabot.png
Normal file
BIN
img/aquabot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Reference in New Issue
Block a user