1
0
Fork 0
mirror of synced 2024-05-20 20:42:27 +12:00

Update to allow nsfw channel management in DM

This commit is contained in:
phxntxm 2017-03-22 22:21:34 -05:00
parent 66099fe6b1
commit 788743de25
2 changed files with 17 additions and 3 deletions

View file

@ -150,7 +150,12 @@ class Mod:
EXAMPLE: !nsfw add
RESULT: ;)"""
key = str(ctx.message.guild.id)
if ctx.message.channel is discord.DMChannel:
key = 'DMs'
else:
key = str(ctx.message.guild.id)
entry = {'server_id': key,
'nsfw_channels': [str(ctx.message.channel.id)]}
update = {'nsfw_channels': r.row['nsfw_channels'].append(str(ctx.message.channel.id))}
@ -173,7 +178,11 @@ class Mod:
EXAMPLE: !nsfw remove
RESULT: ;("""
key = str(ctx.message.guild.id)
if ctx.message.channel is discord.DMChannel:
key = 'DMs'
else:
key = str(ctx.message.guild.id)
server_settings = await utils.get_content('server_settings', key)
channel = str(ctx.message.channel.id)
try:

View file

@ -1,6 +1,7 @@
import aiohttp
from io import BytesIO
import inspect
import discord
from . import config
from PIL import Image
@ -44,7 +45,11 @@ def get_subcommands(command):
pass
async def channel_is_nsfw(channel):
server = str(channel.guild.id)
if channel is discord.DMChannel:
server = 'DMs'
else:
server = str(channel.guild.id)
channel = str(channel.id)
server_settings = await config.get_content('server_settings', server)