diff --git a/launch.py b/launch.py index cead92dfeb1db3dffabd0d59061c39767289bf20..e3cfd8193f0414423dd66397302f66f96dc8adb7 100644 --- a/launch.py +++ b/launch.py @@ -4,6 +4,7 @@ import praw import random import re import csv +import aiohttp from dotenv import load_dotenv @@ -14,6 +15,7 @@ SECRET = os.getenv('REDDIT_SECRET') REDDIT_ID = os.getenv('REDDIT_ID') REDDIT_AGENT = os.getenv('REDDIT_AGENT') +PROXY = os.getenv('PROXY') postLimit = int(os.getenv('POST_LIMIT')) subreddits = dict() @@ -75,7 +77,11 @@ def create_embed(post,author,posturl): return embed refresh_all_posts() -client = discord.Client() + +if PROXY != "": + client = discord.Client(proxy=PROXY) +else: + client = discord.Client() @client.event async def on_ready(): @@ -90,7 +96,7 @@ async def on_message(message): mess = "Usage : ``show me a xxxx`` or ``show me an xxxx`` or ``show me more xxxx``\nCurrently, I can show :```" for entry in subreddits.values(): mess += entry.name + " with a picture from r/" + entry.subName + "\n" - mess += "```" + mess += "\n```" await message.channel.send(mess) if ("show me a" in lower) or ("show me more" in lower): name = re.search(r"show me (an?|more) ([\S]+)", lower)