CHANGE: Using pyre was stupid. I am stupid

pull/3/head
Kamal Curi 3 years ago
parent 688b05dccf
commit 11de44cc7d

@ -1,5 +1,3 @@
Cython
discord.py discord.py
mysqlclient mysqlclient
SQLAlchemy SQLAlchemy
pyre2

@ -3,9 +3,9 @@ Bot commands.
""" """
import logging import logging
from random import choice from random import choice
import re2
from discord.ext import commands from discord.ext import commands
from discord import Intents
from settings.config import IMAGE_TYPES, PERMISSIONS from settings.config import IMAGE_TYPES, PERMISSIONS
from utils.database import get_by_id, get_quotes, remove_quote, set_quote, count_quotes from utils.database import get_by_id, get_quotes, remove_quote, set_quote, count_quotes
@ -15,7 +15,7 @@ from settings.config import PERMISSIONS, OW_API_CONFIG
from utils.database import (count_quotes, get_by_id, get_quote_contains, from utils.database import (count_quotes, get_by_id, get_quote_contains,
get_quotes, remove_quote, set_quote) get_quotes, remove_quote, set_quote)
client = commands.Bot(command_prefix='--') client = commands.Bot(command_prefix='--', intents=Intents.all())
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
quote_id_stack = [] quote_id_stack = []
@ -196,7 +196,7 @@ async def weather(bot: object, *location: str) -> str:
(The weather command hansn't been set up properly, make sure you have `OPENWEATHER_API_TOKEN` set up") (The weather command hansn't been set up properly, make sure you have `OPENWEATHER_API_TOKEN` set up")
if location: if location:
location = str(location) location = str(location)
stripped = re2.sub(" ", "", location) # Strips all whitespace stripped = location.replace(" ", "") # Strips all whitespace
separated = stripped.split(',') # Splits between commas separated = stripped.split(',') # Splits between commas
separated.pop(-1) separated.pop(-1)
separated[0] = separated[0][1:len(separated[0])] # These two commands clean up input for the parser separated[0] = separated[0][1:len(separated[0])] # These two commands clean up input for the parser

@ -4,7 +4,6 @@ from settings.config import OW_API_CONFIG
import urllib.request import urllib.request
import json import json
import re2
def geocode(city = 'curitiba', state = 'parana', country = 'BR') -> str: def geocode(city = 'curitiba', state = 'parana', country = 'BR') -> str:
""" """
@ -15,10 +14,10 @@ def geocode(city = 'curitiba', state = 'parana', country = 'BR') -> str:
state = 'parana' state = 'parana'
country = 'BR' country = 'BR'
ow_gc_url = OW_API_CONFIG['gc_url'] ow_gc_url = OW_API_CONFIG['gc_url']
ow_gc_url = re2.sub('<CITY>', city, ow_gc_url) ow_gc_url = ow_gc_url.replace('<CITY>', city)
ow_gc_url = re2.sub('<STATE>', state, ow_gc_url) ow_gc_url = ow_gc_url.replace('<STATE>', state)
ow_gc_url = re2.sub('<COUNTRY', country, ow_gc_url) ow_gc_url = ow_gc_url.replace('<COUNTRY', country)
ow_gc_url = re2.sub('<API_ID>', OW_API_CONFIG['api_id'], ow_gc_url) ow_gc_url = ow_gc_url.replace('<API_ID>', OW_API_CONFIG['api_id'])
placedata = urllib.request.urlopen(ow_gc_url) placedata = urllib.request.urlopen(ow_gc_url)
placedata = placedata.read().decode() placedata = placedata.read().decode()
@ -31,9 +30,9 @@ def getweatherdata(lat, lon):
Gets weather data based on coordinates Gets weather data based on coordinates
""" """
ow_wh_url = OW_API_CONFIG['wh_url'] ow_wh_url = OW_API_CONFIG['wh_url']
ow_wh_url = re2.sub('<LAT>', lat, ow_wh_url) ow_wh_url = ow_wh_url.replace('<LAT>', lat)
ow_wh_url = re2.sub('<LON>', lon, ow_wh_url) ow_wh_url = ow_wh_url.replace('<LON>', lon)
ow_wh_url = re2.sub('<API_ID>', OW_API_CONFIG['api_id'], ow_wh_url) ow_wh_url = ow_wh_url.replace('<API_ID>', OW_API_CONFIG['api_id'])
weatherdata = urllib.request.urlopen(ow_wh_url) weatherdata = urllib.request.urlopen(ow_wh_url)
weatherdata = weatherdata.read().decode() weatherdata = weatherdata.read().decode()

Loading…
Cancel
Save