1
0
Fork 0
mirror of synced 2024-06-26 18:21:15 +12:00

Corrected nsfw channels and rules

This commit is contained in:
phxntxm 2016-08-30 21:54:32 -05:00
parent 138021bd90
commit d522726cc7
2 changed files with 7 additions and 7 deletions

View file

@ -70,7 +70,7 @@ class Links:
# This sets the url as url?q=search+terms
url = 'https://derpibooru.org/search.json?q={}'.format('+'.join(search))
nsfw_channels = await config.get_content("nsfw_channels")
nsfw_channels = nsfw_channels.get('registered')
nsfw_channels = nsfw_channels.get('registered') or []
# If this is a nsfw channel, we just need to tack on 'explicit' to the terms
# Also use the custom filter that I have setup, that blocks some certain tags
# If the channel is not nsfw, we don't need to do anything, as the default filter blocks explicit
@ -127,7 +127,7 @@ class Links:
await self.bot.say("Looking up an image with those tags....")
nsfw_channels = await config.get_content("nsfw_channels")
nsfw_channels = nsfw_channels.get('registered')
nsfw_channels = nsfw_channels.get('registered') or []
# e621 by default does not filter explicit content, so tack on
# safe/explicit based on if this channel is nsfw or not
if ctx.message.channel.id in nsfw_channels:

View file

@ -55,7 +55,7 @@ class Mod:
"""Registers this channel as a 'nsfw' channel"""
nsfw_channels = await config.get_content('nsfw_channels')
# rethinkdb cannot save a list as a field, so we need a dict with one elemtn to store our list
nsfw_channels = nsfw_channels.get('registered')
nsfw_channels = nsfw_channels.get('registered') or []
if ctx.message.channel.id in nsfw_channels:
await self.bot.say("This channel is already registered as 'nsfw'!")
else:
@ -69,7 +69,7 @@ class Mod:
async def nsfw_remove(self, ctx):
"""Removes this channel as a 'nsfw' channel"""
nsfw_channels = await config.get_content('nsfw_channels')
nsfw_channels = nsfw_channels.get('registered')
nsfw_channels = nsfw_channels.get('registered') or []
if ctx.message.channel.id not in nsfw_channels:
await self.bot.say("This channel is not registered as a ''nsfw' channel!")
else:
@ -303,7 +303,7 @@ class Mod:
"""This command can be used to view the current rules on the server"""
rules = await config.get_content('rules')
# Same issue as the nsfw channels
rules = rules.get('rules')
rules = rules.get('rules') or {}
server_rules = rules.get(ctx.message.server.id)
if server_rules is None or len(server_rules) == 0:
await self.bot.say("This server currently has no rules on it! I see you like to live dangerously...")
@ -318,7 +318,7 @@ class Mod:
"""Adds a rule to this server's rules"""
# Nothing fancy here, just get the rules, append the rule, and save it
rules = await config.get_content('rules')
rules = rules.get('rules')
rules = rules.get('rules') or {}
server_rules = rules.get(ctx.message.server.id)
server_rules.append(rule)
rules[ctx.message.server.id] = server_rules
@ -332,7 +332,7 @@ class Mod:
Provide a number to delete that rule; if no number is provided
I'll print your current rules and ask for a number"""
rules = await config.get_content('rules')
rules = rules.get('rules')
rules = rules.get('rules') or {}
server_rules = rules.get(ctx.message.server.id)
if server_rules is None or len(server_rules) == 0:
await self.bot.say(