Add AquaBot title
and some other minor changes
This commit is contained in:
@@ -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))
|
||||
bot.add_cog(Admin(bot))
|
||||
@@ -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))
|
||||
@@ -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))
|
||||
bot.add_cog(General(bot))
|
||||
21
cogs/help.py
21
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))
|
||||
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
|
||||
|
||||
# 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))
|
||||
bot.add_cog(Welcome(bot))
|
||||
Reference in New Issue
Block a user