QOL Updates

This commit is contained in:
Marco Thomas
2021-03-03 17:44:47 +01:00
parent e14a1ef2a3
commit 87bce0be57
12 changed files with 24 additions and 104 deletions

View File

@@ -3,9 +3,9 @@ FROM python:3.8-alpine
WORKDIR /data
COPY . /data
RUN apk add .build-deps gcc libc-dev \
apk add ffmpeg \
&& python3 -m pip install -r requirements.txt
RUN apk add gcc libc-dev \
&& python3 -m pip install -r requirements.txt \
&& apk del gcc libc-dev
ENV PREFIX /data
ENV TOKEN /data

View File

@@ -5,10 +5,9 @@
\__,_|\__, |\__,_|\__,_|_.__/ \___/ \__|
|_|
created by Marc.
by MarcMK
This project uses discordpy:
https://discordpy.readthedocs.io/en/latest/intro.html
This project uses discordpy: https://discordpy.readthedocs.io/en/latest/intro.html
"""
import discord
@@ -17,7 +16,7 @@ import logging
import platform
import os
# Environment
PREFIX = os.environ['PREFIX']
TOKEN = os.environ['TOKEN']
REDDIT_CLIENT_ID = os.environ['REDDIT_CLIENT_ID']
@@ -25,33 +24,26 @@ REDDIT_CLIENT_SECRET = os.environ['REDDIT_CLIENT_SECRET']
REDDIT_CLIENT_USERAGENT = os.environ['REDDIT_CLIENT_USERAGENT']
AVATAR = "https://i.redd.it/0uajctrps9u41.jpg"
# Logger
logger = logging.getLogger("discord")
logger.setLevel(logging.INFO)
handler = logging.FileHandler(
filename="logs/discord.log",
encoding="utf-8",
mode="w")
handler.setFormatter(
logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s"))
handler = logging.FileHandler(filename="logs/discord.log", encoding="utf-8", mode="w")
handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s"))
logger.addHandler(handler)
bot = commands.Bot(
command_prefix=PREFIX,
description="Holy Goddess Aqua!")
# Bot declaration
bot = commands.Bot(command_prefix=PREFIX, description="Holy Goddess Aqua!")
# Preloaded Cogs
cogs = [
"cogs.admin",
cogs = ["cogs.admin",
"cogs.anime",
"cogs.help",
"cogs.jikan",
"cogs.meme",
"cogs.music",
# "cogs.music",
"cogs.reddit",
"cogs.utility",
"cogs.welcome"
]
"cogs.welcome"]
for cog in cogs:
try:
@@ -61,13 +53,9 @@ for cog in cogs:
else:
print(f"SUCCESS: Loaded {cog}")
########## Start Bot
# Start Bot
@bot.event
async def on_ready():
"""
This prints some information about the bot, while starting up
"""
bot.AppInfo = await bot.application_info()
startup = f"""
@@ -76,17 +64,15 @@ async def on_ready():
Command Prefix: {PREFIX}\n
discord.py Version: {discord.__version__}\n
python Version: {platform.python_version()}\n
OS: {platform.system()} {platform.release()} {platform.version()}\n
"""
print(startup)
name = f"with water | {PREFIX}aquabot"
activity = discord.Activity(name=name, type=discord.ActivityType.playing)
activity_name = f"with water | {PREFIX}aquabot"
activity = discord.Activity(activity_name=name, type=discord.ActivityType.playing)
await bot.change_presence(activity=activity)
print("AquaBot is ready!\n")
bot.run(TOKEN,
bot=True,
reconnect=True)

View File

@@ -1,11 +1,10 @@
"""
Admin commands, that can be used from within the discord-client-chat
Admin commands, that can be used within the Discord Client
"""
import discord
from discord.ext import commands
class Admin(commands.Cog):
def __init__(self, bot):
self.bot = bot

View File

@@ -1,5 +1,5 @@
"""
Some help for the users
User help
"""
import discord
@@ -7,7 +7,6 @@ from discord.ext import commands
from __main__ import PREFIX
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot

View File

@@ -1,5 +1,5 @@
"""
Jikan is an unofficial api to access data from myanimelist
Jikan is an unofficial API to access data from MyAnimeList
https://jikanpy.readthedocs.io/en/latest/
"""
@@ -7,13 +7,13 @@ import discord
from discord.ext import commands
from jikanpy import Jikan
jikan = Jikan()
class Jikan(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.group(name="anime")
async def anime(self, ctx):
if ctx.invoked_subcommand is None:

View File

@@ -8,7 +8,6 @@ import random
import memes
class Meme(commands.Cog):
def __init__(self, bot):
self.bot = bot

View File

@@ -1,7 +1,7 @@
"""
Play Music
A COG ORIGINALLY CREATED BY ME, I ALTERED THIS ONE TO FIT MY NEEDS
A COG ORIGINALLY NOT CREATED BY ME, I ALTERED THIS ONE TO FIT MY NEEDS
https://gist.github.com/vbe0201/ade9b80f2d3b64643d854938d40a0a2d
"""
@@ -392,18 +392,6 @@ class Music(commands.Cog):
if ctx.voice_client.channel != ctx.author.voice.channel:
raise commands.CommandError('Bot is already in a voice channel.')
# @commands.command(name='loop')
# async def loop(self, ctx: commands.Context):
# """
# Loops the currently playing song.
# """
# if not ctx.voice_state.is_playing:
# return await ctx.send('Nothing being played at the moment.')
#
# # Swap states
# ctx.voice_state.loop = not ctx.voice_state.loop
# await ctx.message.add_reaction('✅')
@commands.command(name="queue")
async def queue(self, ctx: commands.Context):

View File

@@ -11,7 +11,6 @@ from __main__ import REDDIT_CLIENT_ID
from __main__ import REDDIT_CLIENT_SECRET
from __main__ import REDDIT_CLIENT_USERAGENT
class Reddit(commands.Cog):
def __init__(self, bot):
self.bot = bot

View File

@@ -1,17 +0,0 @@
"""
A simple reminder option
"""
import discord
from discord.ext import commands
class Reminder(commands.Cog):
def __init__(self, bot):
self.bot = bot
def setup(bot):
bot.add_cog(Reminder(bot))

View File

@@ -1,5 +1,5 @@
"""
Some (more or less) handy utility
Some utility commands
"""
import discord

View File

@@ -1,33 +0,0 @@
"""
Welcoming new users etc.
"""
import discord
from discord.ext import commands
class Welcome(commands.Cog):
def __init__(self, bot):
self.bot = bot
@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 Discord!"
if channel is not None:
await channel.send(text)
@commands.command(name="hello")
async def hello(self, ctx):
"""
Sends a simple reply to the user
"""
await ctx.send(f"Hello {ctx.author.mention}!")
def setup(bot):
bot.add_cog(Welcome(bot))

View File

@@ -1,4 +1,4 @@
discord.py[voice]
discord.py
youtube-dl
praw
argparse