Capitalize ENV vars
This commit is contained in:
18
aquabot.py
18
aquabot.py
@@ -25,11 +25,11 @@ import sys
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# SET VARS
|
# SET VARS
|
||||||
prefix = os.environ['PREFIX']
|
PREFIX = os.environ['PREFIX']
|
||||||
token = os.environ['TOKEN']
|
TOKEN = os.environ['TOKEN']
|
||||||
reddit_client_id = os.environ['REDDIT_CLIENT_ID']
|
REDDIT_CLIENT_ID = os.environ['REDDIT_CLIENT_ID']
|
||||||
reddit_client_secret = os.environ['REDDIT_CLIENT_SECRET']
|
REDDIT_CLIENT_SECRET = os.environ['REDDIT_CLIENT_SECRET']
|
||||||
reddit_client_useragent = os.environ['REDDIT_CLIENT_USERAGENT']
|
REDDIT_CLIENT_USERAGENT = os.environ['REDDIT_CLIENT_USERAGENT']
|
||||||
|
|
||||||
avatar = "https://i.redd.it/0uajctrps9u41.jpg"
|
avatar = "https://i.redd.it/0uajctrps9u41.jpg"
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ logger.addHandler(handler)
|
|||||||
|
|
||||||
# INIT
|
# INIT
|
||||||
bot = commands.Bot(
|
bot = commands.Bot(
|
||||||
command_prefix=prefix,
|
command_prefix=PREFIX,
|
||||||
description="Holy Goddess Aqua!")
|
description="Holy Goddess Aqua!")
|
||||||
|
|
||||||
# LOAD COGS
|
# LOAD COGS
|
||||||
@@ -81,14 +81,14 @@ async def on_ready():
|
|||||||
startup = f"""
|
startup = f"""
|
||||||
Bot Name: {bot.user.name} - {bot.user.id}\n
|
Bot Name: {bot.user.name} - {bot.user.id}\n
|
||||||
Owner: {bot.AppInfo.owner}\n
|
Owner: {bot.AppInfo.owner}\n
|
||||||
Command Prefix: {prefix}\n
|
Command Prefix: {PREFIX}\n
|
||||||
discord.py Version: {discord.__version__}\n
|
discord.py Version: {discord.__version__}\n
|
||||||
python Version: {platform.python_version()}\n
|
python Version: {platform.python_version()}\n
|
||||||
OS: {platform.system()} {platform.release()} {platform.version()}\n
|
OS: {platform.system()} {platform.release()} {platform.version()}\n
|
||||||
"""
|
"""
|
||||||
print(startup)
|
print(startup)
|
||||||
|
|
||||||
name = f"with water | {prefix}aquabot"
|
name = f"with water | {PREFIX}aquabot"
|
||||||
activity = discord.Activity(name=name, type=discord.ActivityType.playing)
|
activity = discord.Activity(name=name, type=discord.ActivityType.playing)
|
||||||
await bot.change_presence(activity=activity)
|
await bot.change_presence(activity=activity)
|
||||||
|
|
||||||
@@ -96,6 +96,6 @@ async def on_ready():
|
|||||||
|
|
||||||
# START BOT
|
# START BOT
|
||||||
bot.run(
|
bot.run(
|
||||||
token,
|
TOKEN,
|
||||||
bot=True,
|
bot=True,
|
||||||
reconnect=True)
|
reconnect=True)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import discord
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
# IMPORTS - internal
|
# IMPORTS - internal
|
||||||
from __main__ import prefix
|
from __main__ import PREFIX
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class Help(commands.Cog):
|
class Help(commands.Cog):
|
||||||
@@ -24,7 +24,7 @@ class Help(commands.Cog):
|
|||||||
embed.set_thumbnail(url=ctx.me.avatar_url)
|
embed.set_thumbnail(url=ctx.me.avatar_url)
|
||||||
|
|
||||||
embed.add_field(name="Owner", value=self.bot.AppInfo.owner, inline=True)
|
embed.add_field(name="Owner", value=self.bot.AppInfo.owner, inline=True)
|
||||||
embed.add_field(name="Command Prefix", value=prefix, inline=True)
|
embed.add_field(name="Command Prefix", value=PREFIX, inline=True)
|
||||||
embed.add_field(name="Source Code", value="[GitHub](https://github.com/crammk/aquabot)", inline=True)
|
embed.add_field(name="Source Code", value="[GitHub](https://github.com/crammk/aquabot)", inline=True)
|
||||||
|
|
||||||
footer_text = "This Bot is a project by [MarcMK](https://marcmk.de)."
|
footer_text = "This Bot is a project by [MarcMK](https://marcmk.de)."
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import random
|
|||||||
import praw
|
import praw
|
||||||
|
|
||||||
# IMPORTS - internal
|
# IMPORTS - internal
|
||||||
from __main__ import reddit_client_id
|
from __main__ import REDDIT_CLIENT_ID
|
||||||
from __main__ import reddit_client_secret
|
from __main__ import REDDIT_CLIENT_SECRET
|
||||||
from __main__ import reddit_client_useragent
|
from __main__ import REDDIT_CLIENT_USERAGENT
|
||||||
|
|
||||||
# COG INIT
|
# COG INIT
|
||||||
class Reddit(commands.Cog):
|
class Reddit(commands.Cog):
|
||||||
@@ -24,9 +24,9 @@ class Reddit(commands.Cog):
|
|||||||
"""
|
"""
|
||||||
Send a post from a subreddit to chat
|
Send a post from a subreddit to chat
|
||||||
"""
|
"""
|
||||||
reddit = praw.Reddit(client_id=reddit_client_id,
|
reddit = praw.Reddit(client_id=REDDIT_CLIENT_ID,
|
||||||
client_secret=reddit_client_secret,
|
client_secret=REDDIT_CLIENT_SECRET,
|
||||||
user_agent=reddit_client_useragent)
|
user_agent=REDDIT_CLIENT_USERAGENT)
|
||||||
|
|
||||||
posts = reddit.subreddit(sub).hot()
|
posts = reddit.subreddit(sub).hot()
|
||||||
rand_post = random.randint(1, 100)
|
rand_post = random.randint(1, 100)
|
||||||
|
|||||||
Reference in New Issue
Block a user