This repository has been archived by the owner on Sep 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaquabot.py
76 lines (63 loc) · 1.99 KB
/
aquabot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""
__ _ __ _ _ _ __ _| |__ ___ | |_
/ _` |/ _` | | | |/ _` | '_ \ / _ \| __|
| (_| | (_| | |_| | (_| | |_) | (_) | |_
\__,_|\__, |\__,_|\__,_|_.__/ \___/ \__|
|_|
by MarcMK
This project uses discordpy: https://discordpy.readthedocs.io/en/latest/intro.html
"""
import discord
from discord.ext import commands
import logging
import platform
import os
# Environment
PREFIX = os.environ['PREFIX']
TOKEN = os.environ['TOKEN']
REDDIT_CLIENT_ID = os.environ['REDDIT_CLIENT_ID']
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"))
logger.addHandler(handler)
# Bot declaration
bot = commands.Bot(command_prefix=PREFIX, description="Holy Goddess Aqua!")
# Preloaded Cogs
cogs = ["cogs.admin",
"cogs.audio",
"cogs.help",
"cogs.jikan",
"cogs.meme",
"cogs.reddit",
"cogs.utility"]
for cog in cogs:
try:
bot.load_extension(cog)
except Exception as e:
print(f"ERROR: {type(e).__name__} - {e}")
else:
print(f"SUCCESS: Loaded {cog}")
# Start Bot
@bot.event
async def on_ready():
bot.AppInfo = await bot.application_info()
startup = f"""
Bot Name: {bot.user.name} - {bot.user.id}\n
Owner: {bot.AppInfo.owner}\n
Command Prefix: {PREFIX}\n
discord.py Version: {discord.__version__}\n
python Version: {platform.python_version()}\n
"""
print(startup)
activity_name = f"with water | {PREFIX}aquabot"
activity = discord.Activity(name=activity_name, type=discord.ActivityType.playing)
await bot.change_presence(activity=activity)
print("AquaBot is ready!\n")
bot.run(TOKEN,
bot=True,
reconnect=True)