diff options
author | 2021-02-11 23:09:08 -0800 | |
---|---|---|
committer | 2021-02-11 23:09:08 -0800 | |
commit | e748bc968eff3e3671d82e1a904f8e94463935e4 (patch) | |
tree | e61cfb617b90a11ddd5d3b306328a835e7453b9e | |
parent | Adds Category Channels To Error Message (diff) | |
parent | Merge pull request #582 from python-discord/wolfram-mock-locations (diff) |
Merge branch 'master' into upgrade-override
-rw-r--r-- | bot/exts/evergreen/cheatsheet.py | 4 | ||||
-rw-r--r-- | bot/exts/evergreen/wolfram.py | 11 | ||||
-rw-r--r-- | docker-compose.yml | 8 |
3 files changed, 15 insertions, 8 deletions
diff --git a/bot/exts/evergreen/cheatsheet.py b/bot/exts/evergreen/cheatsheet.py index 8e61f63e..3fe709d5 100644 --- a/bot/exts/evergreen/cheatsheet.py +++ b/bot/exts/evergreen/cheatsheet.py @@ -26,6 +26,8 @@ If the problem persists send a message in <#{Channels.dev_contrib}> URL = 'https://cheat.sh/python/{search}' ESCAPE_TT = str.maketrans({"`": "\\`"}) ANSI_RE = re.compile(r"\x1b\[.*?m") +# We need to pass headers as curl otherwise it would default to aiohttp which would return raw html. +HEADERS = {'User-Agent': 'curl/7.68.0'} class CheatSheet(commands.Cog): @@ -86,7 +88,7 @@ class CheatSheet(commands.Cog): search_string = quote_plus(" ".join(search_terms)) async with self.bot.http_session.get( - URL.format(search=search_string) + URL.format(search=search_string), headers=HEADERS ) as response: result = ANSI_RE.sub("", await response.text()).translate(ESCAPE_TT) diff --git a/bot/exts/evergreen/wolfram.py b/bot/exts/evergreen/wolfram.py index 898e8d2a..437d9e1a 100644 --- a/bot/exts/evergreen/wolfram.py +++ b/bot/exts/evergreen/wolfram.py @@ -108,7 +108,10 @@ async def get_pod_pages(ctx: Context, bot: commands.Bot, query: str) -> Optional "input": query, "appid": APPID, "output": DEFAULT_OUTPUT_FORMAT, - "format": "image,plaintext" + "format": "image,plaintext", + "location": "the moon", + "latlong": "0.0,0.0", + "ip": "1.1.1.1" }) request_url = QUERY.format(request="query", data=url_str) @@ -168,6 +171,9 @@ class Wolfram(Cog): url_str = parse.urlencode({ "i": query, "appid": APPID, + "location": "the moon", + "latlong": "0.0,0.0", + "ip": "1.1.1.1" }) query = QUERY.format(request="simple", data=url_str) @@ -248,6 +254,9 @@ class Wolfram(Cog): url_str = parse.urlencode({ "i": query, "appid": APPID, + "location": "the moon", + "latlong": "0.0,0.0", + "ip": "1.1.1.1" }) query = QUERY.format(request="result", data=url_str) diff --git a/docker-compose.yml b/docker-compose.yml index bb6ad6ac..a18534a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,13 +12,9 @@ services: - redis environment: - - BOT_TOKEN - - BOT_DEBUG - - BOT_GUILD - - BOT_ADMIN_ROLE_ID - - CHANNEL_DEVLOG - - CHANNEL_COMMUNITY_BOT_COMMANDS - REDIS_HOST=redis + env_file: + - .env volumes: - .:/bot |