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
|
EXAMPLE: !nsfw add
|
||||||
RESULT: ;)"""
|
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,
|
entry = {'server_id': key,
|
||||||
'nsfw_channels': [str(ctx.message.channel.id)]}
|
'nsfw_channels': [str(ctx.message.channel.id)]}
|
||||||
update = {'nsfw_channels': r.row['nsfw_channels'].append(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
|
EXAMPLE: !nsfw remove
|
||||||
RESULT: ;("""
|
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)
|
server_settings = await utils.get_content('server_settings', key)
|
||||||
channel = str(ctx.message.channel.id)
|
channel = str(ctx.message.channel.id)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import inspect
|
import inspect
|
||||||
|
import discord
|
||||||
|
|
||||||
from . import config
|
from . import config
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -44,7 +45,11 @@ def get_subcommands(command):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def channel_is_nsfw(channel):
|
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)
|
channel = str(channel.id)
|
||||||
|
|
||||||
server_settings = await config.get_content('server_settings', server)
|
server_settings = await config.get_content('server_settings', server)
|
||||||
|
|
Loading…
Reference in a new issue