Corrected error where no nsfw_channel was found
This commit is contained in:
parent
f8b767eb1c
commit
600a704e8b
|
@ -107,14 +107,10 @@ class Core:
|
|||
dice = re.search("(\d*)d(\d*)", notation).group(1)
|
||||
num = int(re.search("(\d*)d(\d*)", notation).group(2))
|
||||
# This error will be hit if the notation is completely different than #d#
|
||||
except AttributeError:
|
||||
await self.bot.say("Please provide the die notation in #d#!")
|
||||
return
|
||||
# This error will be hit if there was an issue converting to an int
|
||||
# This means the notation was still given wrong
|
||||
except ValueError:
|
||||
except (AttributeError, ValueError):
|
||||
await self.bot.say("Please provide the die notation in #d#!")
|
||||
return
|
||||
|
||||
# Dice will be None if d# was provided, assume this means 1d#
|
||||
dice = dice or 1
|
||||
dice = int(dice)
|
||||
|
|
|
@ -37,7 +37,8 @@ class Links:
|
|||
if len(search) > 0:
|
||||
# This sets the url as url?q=search+terms
|
||||
url = 'https://derpibooru.org/search.json?q={}'.format('+'.join(search))
|
||||
if ctx.message.channel.id in config.getContent("nsfw_channels"):
|
||||
nsfw_channels = config.getContent("nsfw_channels") or {}
|
||||
if ctx.message.channel.id in nsfw_channels:
|
||||
url += ",+explicit&filter_id=95938"
|
||||
|
||||
# Get the response from derpibooru and parse the 'search' result from it
|
||||
|
@ -78,7 +79,8 @@ class Links:
|
|||
url = 'https://e621.net/post/index.json?limit=320&tags={}'.format(tags)
|
||||
await self.bot.say("Looking up an image with those tags....")
|
||||
|
||||
if ctx.message.channel.id in config.getContent('nsfw_channels'):
|
||||
nsfw_channels = config.getContent("nsfw_channels") or {}
|
||||
if ctx.message.channel.id in nsfw_channels:
|
||||
url += "%20rating:explicit"
|
||||
else:
|
||||
url += "%20rating:safe"
|
||||
|
|
Loading…
Reference in a new issue