extending list, checking in embed fields

This commit is contained in:
Giulio De Pasquale 2021-06-21 14:06:47 +01:00
parent 6be34d5305
commit 7474cf1b4e

11
app.py
View File

@ -88,10 +88,9 @@ def check_urls(urls: List[str]):
if not url: if not url:
continue continue
print(f'Opening {url}')
webbrowser.open(url) webbrowser.open(url)
print(f'Opened {url}')
def check_price(message: str) -> bool: def check_price(message: str) -> bool:
prices = { prices = {
@ -142,11 +141,15 @@ def on_message(resp):
if channel_id in MONITORED_CHANNELS: if channel_id in MONITORED_CHANNELS:
# search for urls in message text # search for urls in message text
urls.append(URL_REGEX.findall(content)) urls.extend(URL_REGEX.findall(content))
# search for urls in embeds # search for urls in embeds
for e in embeds: for e in embeds:
urls.append(URL_REGEX.findall(e['value'])) for f in [x['value'] for x in e['fields']]:
urls.extend(URL_REGEX.findall(f))
if not urls:
print(m)
if (urls): if (urls):
check_urls(urls) check_urls(urls)