General development process

- new cog commands
- new voice cog
- new requirements.txt
- adjusted readme
- added Dockerfile for faster deployment (still WIP)
- other general things
This commit is contained in:
CramMK
2020-01-23 15:57:30 +00:00
parent 10c65cfda4
commit a653476e9c
14 changed files with 217 additions and 52 deletions

View File

@@ -1,17 +1,10 @@
#
# 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
#
"""
Admin commands, that can be used from within the chat
Admin commands, that can be used from within the chat:
- load
- unload
- reload
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"load", "unload", "reload"
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
"""
@@ -70,4 +63,4 @@ class Admin(commands.Cog):
# COG ENDING
def setup(bot):
bot.add_cog(Admin(bot))
bot.add_cog(Admin(bot))

View File

@@ -1,5 +1,6 @@
"""
Some anime-related commands
Some anime-related commands:
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
@@ -9,7 +10,7 @@ import discord
from discord.ext import commands
# COG INIT
class Adnime(commands.Cog):
class Anime(commands.Cog):
def __init__(self, bot):
self.bot = bot
@@ -17,4 +18,4 @@ class Adnime(commands.Cog):
# COG ENDING
def setup(bot):
bot.add_cog(Adnime(bot))
bot.add_cog(Anime(bot))

View File

@@ -1,5 +1,6 @@
"""
Some general commands
Some general commands:
- about
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
@@ -8,6 +9,9 @@ https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
import discord
from discord.ext import commands
# IMPORTS - internal
from aquabot import metadata
# COG INIT
class General(commands.Cog):
def __init__(self, bot):
@@ -21,14 +25,22 @@ class General(commands.Cog):
"""
embed = discord.Embed(colour=discord.Colour.blue())
embed.add_field(name="test", value="test2")
embed.add_field(name="Bot Name", value=metadata["name"], inline=True)
embed.add_field(name="Admin", value=metadata["admin"], inline=True)
embed.add_field(name="Prefix", value=metadata["prefix"], inline=True)
embed.add_field(name="discord.py Version", value=metadata["discordpy_version"], inline=True)
embed.add_field(name="python Version", value=metadata["python_version"], inline=True)
embed.add_field(name="OS", value=metadata["os"], inline=True)
embed.set_footer(text="footer", icon_url="img/avatar.png")
footer_text = """
This Bot is an OpenSource project by Marc and can be found on
github.com/CramMK/aquabot
"""
embed.set_footer(text=footer_text, icon_url="img/avatar.png")
await ctx.send(embed=embed)
# COG ENDING
def setup(bot):
bot.add_cog(General(bot))
bot.add_cog(General(bot))

View File

@@ -1,5 +1,6 @@
"""
Some help for the users
Some help for the users:
- aquabot
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
@@ -14,19 +15,18 @@ class Help(commands.Cog):
self.bot = bot
# COG BODY
@commands.command( name="aquabot")
@commands.command(name="aquabot")
async def aquabot(self, ctx):
"""
Sends a short help for new users
"""
response = """
I'm the usele... divine AquaBot!
I'm the usele... divine AquaBot!\n
If you need help, try using the `help` command!
"""
await ctx.send(response)
# COG ENDING
def setup(bot):
bot.add_cog(Help(bot))
bot.add_cog(Help(bot))

View File

@@ -1,5 +1,7 @@
"""
Some nice utility
Some (more or less) handy utility:
- invitelink
- pat
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
@@ -19,7 +21,6 @@ class Utility(commands.Cog):
"""
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)

76
cogs/voice.py Normal file
View File

@@ -0,0 +1,76 @@
"""
Make Aqua be able to join voice channel and play audio:
- join
- leave
- play
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS
import discord
from discord.ext import commands
from discord.utils import get
# COG INIT
class Voice(commands.Cog):
def __init__(self, bot):
self.bot = bot
# COG BODY
@commands.command(name="join", aliases=["j"])
@commands.guild_only()
async def join(self, ctx):
"""
Tries to join the author's current voice channel
"""
channel = ctx.message.author.voice.channel
if not channel:
ctx.send:("You're not connected to a voice channel!")
return
voice = get(bot.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
await ctx.send(f"`Joined {channel}!`")
""" useless?
await voice.disconnect()
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
await ctx.send(f"`Joined {channel}!`")
"""
@commands.command(name="leave", aliases=["quit, l"])
@commands.guild_only()
async def leave(self, ctx):
"""
Leaves the voice channel, if connected
"""
channel = ctx.message.author.voice.channel
voice = get(bot.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.disconnect()
await ctx.send(f"`Left {channel}!`")
else:
ctx.send("I'm not connected to a channel!")
@commands.command(name="play", aliases=["p"])
@commands.guild_only()
async def play(self, ctx, url: str):
"""
Plays music from YT link specifies
"""
# TODO
ctx.send("This module is not working yet!")
# COG ENDING
def setup(bot):
bot.add_cog(Voice(bot))

View File

@@ -1,5 +1,7 @@
"""
Welcoming new users etc.
Welcoming new users etc.:
- listener: join
- hello
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
@@ -28,9 +30,12 @@ class Welcome(commands.Cog):
@commands.command(name="hello")
async def hello(self, ctx):
"""
Sends a simple reply to the user
"""
await ctx.send(f"Hello {ctx.author.mention}!")
# COG ENDING
def setup(bot):
bot.add_cog(Welcome(bot))
bot.add_cog(Welcome(bot))