From 4cd51a977525c73883b452d0cd24ba04aa00ce14 Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Wed, 7 Apr 2021 11:54:21 -0700 Subject: [PATCH] [Dictionary] Not everything has an entry --- dictionary/dictionary.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dictionary/dictionary.py b/dictionary/dictionary.py index a94b357..07d3447 100644 --- a/dictionary/dictionary.py +++ b/dictionary/dictionary.py @@ -51,7 +51,10 @@ class Dictionary(commands.Cog): if not data: return await ctx.send("Error fetching data.") section = data.find_all("ul", {"class": "css-1dnnh8h e1ccqdb60"}) - antonyms = section[0].text.split() + if len(section) > 0: + antonyms = section[0].text.split() + else: + antonyms = [] return antonyms @commands.command() @@ -112,7 +115,10 @@ class Dictionary(commands.Cog): if not data: return await ctx.send("Error fetching data.") section = data.find_all("ul", {"class": "css-1l7o0dd e1ccqdb60"}) - synonyms = section[0].text.split() + if len(section) > 0: + synonyms = section[0].text.split() + else: + synonyms = [] return synonyms @commands.command()