Update to allow nsfw channel management in DM
This commit is contained in:
parent
66099fe6b1
commit
788743de25
13
cogs/mod.py
13
cogs/mod.py
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue