|
|
|
|
|
|
|
|
import random |
|
|
import random |
|
|
import requests |
|
|
import requests |
|
|
from bs4 import BeautifulSoup |
|
|
from bs4 import BeautifulSoup |
|
|
|
|
|
import checks |
|
|
|
|
|
|
|
|
# Warning, this cog sucks so much but hopefully it works and doesn't break the bot too much. Just lazily edited old code and bodged it into this one. |
|
|
# Warning, this cog sucks so much but hopefully it works and doesn't break the bot too much. Just lazily edited old code and bodged it into this one. |
|
|
# There is redundant code here that if removed would make it easier. But it might be handy in the future and isn't that bad. |
|
|
# There is redundant code here that if removed would make it easier. But it might be handy in the future and isn't that bad. |
|
|
|
|
|
|
|
|
for x in range(10): |
|
|
for x in range(10): |
|
|
choice = random.choice(links) |
|
|
choice = random.choice(links) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
if choice["data"]["over_18"] and not self.servers[ctx.message.server.id]["nsfw"]["enabled"]: |
|
|
|
|
|
return await self.bot.say("This server doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
|
|
|
|
|
|
print(checks.is_nfsw_enabled()) |
|
|
|
|
|
if choice["data"]["over_18"] and not checks.nsfw_predicate(ctx): |
|
|
|
|
|
return await self.bot.say("This server/channel doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |
|
|
if url: |
|
|
if url: |
|
|
break |
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
choice = random.choice(links) |
|
|
choice = random.choice(links) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
if choice["data"]["over_18"] and not self.servers[ctx.message.server.id]["nsfw"]["enabled"]: |
|
|
|
|
|
|
|
|
if choice["data"]["over_18"] and not checks.nsfw_predicate(ctx): |
|
|
return await self.bot.say( |
|
|
return await self.bot.say( |
|
|
"This server doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
"This server doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
choice = random.choice(links) |
|
|
choice = random.choice(links) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
if choice["data"]["over_18"] and not self.servers[ctx.message.server.id]["nsfw"]["enabled"]: |
|
|
|
|
|
|
|
|
if choice["data"]["over_18"] and not checks.nsfw_predicate(ctx): |
|
|
return await self.bot.say( |
|
|
return await self.bot.say( |
|
|
"This server doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
"This server doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
choice = random.choice(links) |
|
|
choice = random.choice(links) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
title = "**{}** from /r/{}\n".format(choice["data"]["title"], subreddit) |
|
|
if choice["data"]["over_18"] and not self.servers[ctx.message.server.id]["nsfw"]["enabled"]: |
|
|
|
|
|
|
|
|
if choice["data"]["over_18"] and not checks.nsfw_predicate(ctx): |
|
|
return await self.bot.say( |
|
|
return await self.bot.say( |
|
|
"This server doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
"This server doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |
|
|
url = Scrapper().retriveurl(choice["data"]["url"]) |