Fixing the lewd error message if someone tries to use it in a not lewd channel

This commit is contained in:
luke 2018-03-19 13:54:54 -07:00
parent dd6e1d303e
commit 35e2cd0b10
2 changed files with 39 additions and 27 deletions

View File

@ -226,6 +226,7 @@ async def on_message(message):
) )
if message.content.startswith('!lewd'): if message.content.startswith('!lewd'):
if 'nsfw' in message.channel.name:
await client.send_message( await client.send_message(
message.channel, message.channel,
embed=generate_embed( embed=generate_embed(
@ -233,6 +234,11 @@ async def on_message(message):
embed_title="{} is being lewd".format(message.author.name) embed_title="{} is being lewd".format(message.author.name)
) )
) )
else:
await client.send_message(
message.channel,
'You can only use this command in NSFW channels'
)
if message.content.startswith('!weather'): if message.content.startswith('!weather'):
await client.send_message( await client.send_message(

View File

@ -41,8 +41,15 @@ def get_from_danbooru(boards, nsfw=True):
return get_from_danbooru(boards) return get_from_danbooru(boards)
def get_lewd(channel_name): def get_lewd():
if 'nsfw' in channel_name: """
get_lewd()
Chooses between getting from reddit or danbooru
If reddit is chosen, picks a random subreddit from the list of boards and
grabs a random image using the get_from_reddit() method
"""
# List of subreddits that have the lewds we seek
boards = [ boards = [
'2Booty', '2Booty',
'ahegao', 'ahegao',
@ -62,4 +69,3 @@ def get_lewd(channel_name):
# This is really bad practice but pass boards to get_from_reddit AND danbooru so it doesnt error # This is really bad practice but pass boards to get_from_reddit AND danbooru so it doesnt error
return random.choice([get_from_reddit.get_image, get_from_danbooru])(boards=boards, nsfw=True) return random.choice([get_from_reddit.get_image, get_from_danbooru])(boards=boards, nsfw=True)
return 'You can only use this command in NSFW channels'