Fixing last commit
This commit is contained in:
@@ -18,7 +18,7 @@ Installation - Docker
|
|||||||
|
|
||||||
`WIP!`
|
`WIP!`
|
||||||
|
|
||||||
+ Clone this repository with `git clne https://github.com/CramMK/aquabot`
|
+ Clone this repository with `git clone https://github.com/CramMK/aquabot`
|
||||||
|
|
||||||
+ Create a `config/config.py`, using the `config/config_example.py` as a
|
+ Create a `config/config.py`, using the `config/config_example.py` as a
|
||||||
guideline
|
guideline
|
||||||
|
|||||||
28
aquabot.py
28
aquabot.py
@@ -9,6 +9,7 @@ https://discordpy.readthedocs.io/en/latest/intro.html
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import logging
|
import logging
|
||||||
|
import platform
|
||||||
|
|
||||||
# IMPORTS - internal
|
# IMPORTS - internal
|
||||||
import loadconfig
|
import loadconfig
|
||||||
@@ -16,9 +17,9 @@ import loadconfig
|
|||||||
# LOGGING
|
# LOGGING
|
||||||
logger = logging.getLogger("discord")
|
logger = logging.getLogger("discord")
|
||||||
# https://docs.python.org/3/library/logging.html#levels
|
# https://docs.python.org/3/library/logging.html#levels
|
||||||
logger.setlevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
handler = logging.FileHandler(
|
handler = logging.FileHandler(
|
||||||
filename="discord_%(asctime)s.log",
|
filename="discord.log",
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
mode="w"
|
mode="w"
|
||||||
)
|
)
|
||||||
@@ -27,16 +28,6 @@ handler.setFormatter(
|
|||||||
)
|
)
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
# SOME DATA THAT CAN BE USED LATER
|
|
||||||
metadata = {
|
|
||||||
"name": f"{bot.user.name} - {bot.user.id}",
|
|
||||||
"admin": f"{self.bot.AppInfo.owner}",
|
|
||||||
"prefix": f"{loadconfig.__token__}",
|
|
||||||
"discordpy_version": f"{discord.__version__}",
|
|
||||||
"python_version": f"{platform.python_version}",
|
|
||||||
"os": f"{platform.system()} {platform.release()} {platform.version()}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# INIT THE BOT
|
# INIT THE BOT
|
||||||
bot = commands.Bot(
|
bot = commands.Bot(
|
||||||
command_prefix=loadconfig.__prefix__,
|
command_prefix=loadconfig.__prefix__,
|
||||||
@@ -61,14 +52,15 @@ async def on_ready():
|
|||||||
Inspired by:
|
Inspired by:
|
||||||
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
|
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
|
||||||
"""
|
"""
|
||||||
|
bot.AppInfo = await bot.application_info()
|
||||||
|
|
||||||
startup = f"""
|
startup = f"""
|
||||||
Bot Name: {metadata["name"]}\n
|
Bot Name: {bot.user.name} - {bot.user.id}\n
|
||||||
Admin: {metadata["admin"]}\n
|
Owner: {bot.AppInfo.owner}\n
|
||||||
Command Prefix: {metadata["prefix"]}\n
|
Command Prefix: {loadconfig.__prefix__}\n
|
||||||
discord.py Version: {metadata["discordpy_version"]}\n
|
discord.py Version: {discord.__version__}\n
|
||||||
python Version: {metadata["python_version"]}\n
|
python Version: {platform.python_version()}\n
|
||||||
OS: {metadata["os"]}\n
|
OS: {platform.system()} {platform.release()} {platform.version()}\n
|
||||||
"""
|
"""
|
||||||
print(startup)
|
print(startup)
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
|
|||||||
# IMPORTS - external
|
# IMPORTS - external
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
import platform
|
||||||
|
|
||||||
# IMPORTS - internal
|
# IMPORTS - internal
|
||||||
from aquabot import metadata
|
import loadconfig
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class General(commands.Cog):
|
class General(commands.Cog):
|
||||||
@@ -24,19 +25,19 @@ class General(commands.Cog):
|
|||||||
Prints some information about myself
|
Prints some information about myself
|
||||||
"""
|
"""
|
||||||
embed = discord.Embed(colour=discord.Colour.blue())
|
embed = discord.Embed(colour=discord.Colour.blue())
|
||||||
|
embed.set_thumbnail(url=ctx.me.avatar_url)
|
||||||
|
|
||||||
embed.add_field(name="Bot Name", value=metadata["name"], inline=True)
|
embed.add_field(name="Owner", value=self.bot.AppInfo.owner, inline=True)
|
||||||
embed.add_field(name="Admin", value=metadata["admin"], inline=True)
|
embed.add_field(name="Command Prefix", value=loadconfig.__prefix__, inline=True)
|
||||||
embed.add_field(name="Prefix", value=metadata["prefix"], inline=True)
|
embed.add_field(name="Discord.py Version", value=discord.__version__, inline=True)
|
||||||
embed.add_field(name="discord.py Version", value=metadata["discordpy_version"], inline=True)
|
embed.add_field(name="Python Version", value=platform.python_version(), inline=True)
|
||||||
embed.add_field(name="python Version", value=metadata["python_version"], inline=True)
|
embed.add_field(name="OS", value=f"{platform.system()} {platform.release()} {platform.version()}", inline=True)
|
||||||
embed.add_field(name="OS", value=metadata["os"], inline=True)
|
|
||||||
|
|
||||||
footer_text = """
|
footer_text = (
|
||||||
This Bot is an OpenSource project by Marc and can be found on
|
"This Bot is an OpenSource project by Marc and can be found "
|
||||||
github.com/CramMK/aquabot
|
"on github.com/CramMK/aquabot"
|
||||||
"""
|
)
|
||||||
embed.set_footer(text=footer_text, icon_url="img/avatar.png")
|
embed.set_footer(text=footer_text, icon_url=loadconfig.__avatar__)
|
||||||
|
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|||||||
@@ -29,22 +29,15 @@ class Voice(commands.Cog):
|
|||||||
ctx.send:("You're not connected to a voice channel!")
|
ctx.send:("You're not connected to a voice channel!")
|
||||||
return
|
return
|
||||||
|
|
||||||
voice = get(bot.voice_clients, guild=ctx.guild)
|
voice = get(self.bot.voice_clients, guild=ctx.guild)
|
||||||
|
|
||||||
if voice and voice.is_connected():
|
if voice and voice.is_connected():
|
||||||
await voice.move_to(channel)
|
await voice.move_to(channel)
|
||||||
|
await ctx.send(f"`Move to {channel}!`")
|
||||||
else:
|
else:
|
||||||
voice = await channel.connect()
|
voice = await channel.connect()
|
||||||
await ctx.send(f"`Joined {channel}!`")
|
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.command(name="leave", aliases=["quit, l"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@@ -53,13 +46,14 @@ class Voice(commands.Cog):
|
|||||||
Leaves the voice channel, if connected
|
Leaves the voice channel, if connected
|
||||||
"""
|
"""
|
||||||
channel = ctx.message.author.voice.channel
|
channel = ctx.message.author.voice.channel
|
||||||
voice = get(bot.voice_clients, guild=ctx.guild)
|
voice = get(self.bot.voice_clients, guild=ctx.guild)
|
||||||
|
|
||||||
if voice and voice.is_connected():
|
if voice and voice.is_connected():
|
||||||
await voice.disconnect()
|
await voice.disconnect()
|
||||||
await ctx.send(f"`Left {channel}!`")
|
await ctx.send(f"`Left {channel}!`")
|
||||||
else:
|
else:
|
||||||
ctx.send("I'm not connected to a channel!")
|
await ctx.send("I'm not connected to a channel!")
|
||||||
|
|
||||||
|
|
||||||
@commands.command(name="play", aliases=["p"])
|
@commands.command(name="play", aliases=["p"])
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ __cogs__ = [
|
|||||||
"cogs.welcome",
|
"cogs.welcome",
|
||||||
"cogs.help",
|
"cogs.help",
|
||||||
"cogs.utility",
|
"cogs.utility",
|
||||||
"cogs.anime"
|
"cogs.anime",
|
||||||
|
"cogs.voice"
|
||||||
]
|
]
|
||||||
@@ -4,6 +4,8 @@ Gather all config data into one file
|
|||||||
loadconfig.py then gets called in aquabot.py
|
loadconfig.py then gets called in aquabot.py
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__avatar__ = "https://i.imgur.com/mskM9dH.png"
|
||||||
|
|
||||||
from config.cogs import __cogs__
|
from config.cogs import __cogs__
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user