Make 'some' changes and add Dockerfile

This commit is contained in:
Marco Thomas
2020-08-31 14:19:43 +02:00
parent 8b54dcf968
commit 6be6e96768
23 changed files with 129 additions and 179 deletions

View File

@@ -21,9 +21,34 @@ from datetime import datetime
import platform
import random
import asyncio
import sys
import argparse
# IMPORTS - internal
import loadconfig
# SET VARS
parser = argparse.ArgumentParser()
parser.add_argument("--prefix", help="Command Prefix")
parser.add_argument("--token", help="Discord Bot Token")
parser.add_argument("--reddit_client_id", help="Reddit Client ID")
parser.add_argument("--reddit_client_secret", help="Reddit Client Secret")
parser.add_argument("--reddit_client_useragent", help="Reddit Client User-Agent")
args = parser.parse_args()
if args.prefix:
prefix = args.prefix
if args.token:
token = args.token
if args.reddit_client_id:
reddit_client_id = args.reddit_client_id
if args.reddit_client_secret:
reddit_client_secret = args.reddit_client_secret
if args.reddit_client_useragent:
reddit_client_useragent = args.reddit_client_useragent
avatar = "https://i.redd.it/0uajctrps9u41.jpg"
# LOGGING
logger = logging.getLogger("discord")
@@ -39,11 +64,22 @@ logger.addHandler(handler)
# INIT
bot = commands.Bot(
command_prefix=loadconfig.__prefix__,
command_prefix=prefix,
description="Holy Goddess Aqua!")
# LOAD COGS SPECIFIED IN 'config/cogs.py'
for cog in loadconfig.__cogs__:
# LOAD COGS
cogs = [
"cogs.admin",
"cogs.anime",
"cogs.help",
"cogs.meme",
"cogs.music",
"cogs.reddit",
"cogs.utility",
"cogs.welcome"
]
for cog in cogs:
try:
bot.load_extension(cog)
except Exception as e:
@@ -62,14 +98,14 @@ async def on_ready():
startup = f"""
Bot Name: {bot.user.name} - {bot.user.id}\n
Owner: {bot.AppInfo.owner}\n
Command Prefix: {loadconfig.__prefix__}\n
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 | {loadconfig.__prefix__}aquabot"
name = f"with water | {prefix}aquabot"
activity = discord.Activity(name=name, type=discord.ActivityType.playing)
await bot.change_presence(activity=activity)
@@ -77,6 +113,6 @@ async def on_ready():
# START BOT
bot.run(
loadconfig.__token__,
token,
bot=True,
reconnect=True)