- More better open source stuff - pls pr me | - More better open source stuff - pls pr me | ||||
- easy setup and get that wiki going | - easy setup and get that wiki going | ||||
### Big Changes | |||||
### Big and Breaking Changes | |||||
- All settings have been decentralised between servers and cogs. All changes to the settings have been moved to independant commands. This doesn't effect custom commands or warnings. | - All settings have been decentralised between servers and cogs. All changes to the settings have been moved to independant commands. This doesn't effect custom commands or warnings. | ||||
- Many commands have had overhalls in how they work. Parameters have changed on a number of commands. Please check documentation on all the commands to familarise yourself with the new way to input params. | - Many commands have had overhalls in how they work. Parameters have changed on a number of commands. Please check documentation on all the commands to familarise yourself with the new way to input params. | ||||
- is_anal setting is now depreciated.`;suck` and `;spank` now only work in channels marked NSFW. | - is_anal setting is now depreciated.`;suck` and `;spank` now only work in channels marked NSFW. | ||||
- perm_roles setting is now depreciated. All commands will work of Discord's permission system. | - perm_roles setting is now depreciated. All commands will work of Discord's permission system. | ||||
- Roxbot will now check for a channel being marked NSFW in Discord rather than her own internal system. Roxbot's NSFW channels have be depreciated. | |||||
### Regular Updates | ### Regular Updates | ||||
#### New Features | #### New Features | ||||
#### Minor Changes | #### Minor Changes | ||||
- Roxbot will remove all redundant settings (removed roles from self assign, etc.). | - Roxbot will remove all redundant settings (removed roles from self assign, etc.). | ||||
- Cogs have a message if they fail to load instead of breaking entire bot. | - Cogs have a message if they fail to load instead of breaking entire bot. | ||||
- NSFW commands should have even less chance of dupes. | |||||
- All time formatting is now standardised. | |||||
- Error messages dont time out anymore. | |||||
- NSFW commands should have even less chance of dupes with better caching. | |||||
- All datetime formatting is now standardised. | |||||
- Error messages don't timeout anymore. | |||||
#### Bug Fixes | #### Bug Fixes | ||||
- `deepfry` command now works all the time. | |||||
- `;deepfry` command now works all the time. | |||||
- Pride filter filenames fixed. | - Pride filter filenames fixed. | ||||
- As many spelling mistakes as possible. | - As many spelling mistakes as possible. | ||||
- If music bot can't find a thumbnail for the now playing embed, it will just not have one; Instead of breaking. | - If music bot can't find a thumbnail for the now playing embed, it will just not have one; Instead of breaking. | ||||
- NSFW commands fixed. | - NSFW commands fixed. | ||||
- Roxbot can now fully function in DMs. Before, she would break. DM's have less commands that can be invoked. | - Roxbot can now fully function in DMs. Before, she would break. DM's have less commands that can be invoked. | ||||
- `;subreddit`'s "subscriptable" error has been fixed. | - `;subreddit`'s "subscriptable" error has been fixed. | ||||
- is_anal value can be changed again and check now works. | |||||
- Common commands that would go over 2000 characters have been paginated to avoid this error. | - Common commands that would go over 2000 characters have been paginated to avoid this error. | ||||
## v1.8.0 | ## v1.8.0 |
from roxbot import guild_settings as gs | from roxbot import guild_settings as gs | ||||
# REMEMBER TO UNCOMMENT THE GSS LINE, ROXIE | |||||
# DO NOT UNCOMMENT GSS IF YOU ARE NOT ROXIE | |||||
# Sets up Logging that discord.py does on its own | # Sets up Logging that discord.py does on its own | ||||
logger = logging.getLogger('discord') | logger = logging.getLogger('discord') | ||||
logger.setLevel(logging.INFO) | logger.setLevel(logging.INFO) |
""" | """ | ||||
import discord | |||||
from discord.ext import commands | |||||
import roxbot | import roxbot | ||||
from roxbot import guild_settings as gs | |||||
# TODO: Clean up this file. | |||||
from discord.ext import commands | |||||
def has_permission_or_owner(**perms): | def has_permission_or_owner(**perms): | ||||
return commands.has_permissions(**perms) | return commands.has_permissions(**perms) | ||||
return commands.check(predicate) | return commands.check(predicate) | ||||
def nsfw_predicate(ctx): | |||||
if isinstance(ctx.channel, discord.DMChannel): | |||||
return False | |||||
nsfw = gs.get(ctx.guild)["nsfw"] | |||||
if not nsfw["channels"] and nsfw["enabled"]: | |||||
return nsfw["enabled"] == 1 | |||||
elif nsfw["enabled"] and nsfw["channels"]: | |||||
return ctx.channel.id in nsfw["channels"] | |||||
else: | |||||
return False | |||||
def is_nfsw_enabled(): | |||||
return commands.check(lambda ctx: nsfw_predicate(ctx)) |
self.settings = { | self.settings = { | ||||
"nsfw": { | "nsfw": { | ||||
"enabled": 0, | "enabled": 0, | ||||
"channels": [], | |||||
"convert": {"enabled": "bool", "channels": "channel"}, | |||||
"convert": {"enabled": "bool"}, | |||||
"blacklist": [] | "blacklist": [] | ||||
} | } | ||||
} | } | ||||
@roxbot.checks.is_nfsw_enabled() | |||||
@commands.is_nsfw() | |||||
@commands.command(hidden=True) | @commands.command(hidden=True) | ||||
async def gelbooru_clone(self, ctx, base_url, post_url, tags): | async def gelbooru_clone(self, ctx, base_url, post_url, tags): | ||||
limit = 150 | limit = 150 | ||||
output = await ctx.send(url) | output = await ctx.send(url) | ||||
await roxbot.utils.delete_option(self.bot, ctx, output, self.bot.get_emoji(444410658101002261) or "❌") | await roxbot.utils.delete_option(self.bot, ctx, output, self.bot.get_emoji(444410658101002261) or "❌") | ||||
@roxbot.checks.is_nfsw_enabled() | |||||
@commands.is_nsfw() | |||||
@commands.command() | @commands.command() | ||||
async def e621(self, ctx, *, tags=""): | async def e621(self, ctx, *, tags=""): | ||||
""" | """ | ||||
base_url = "https://e621.net/post/index.json?tags=" | base_url = "https://e621.net/post/index.json?tags=" | ||||
return await ctx.invoke(self.gelbooru_clone, base_url=base_url, post_url="", tags=tags) | return await ctx.invoke(self.gelbooru_clone, base_url=base_url, post_url="", tags=tags) | ||||
@roxbot.checks.is_nfsw_enabled() | |||||
@commands.is_nsfw() | |||||
@commands.command() | @commands.command() | ||||
async def rule34(self, ctx, *, tags=""): | async def rule34(self, ctx, *, tags=""): | ||||
""" | """ | ||||
post_url = "https://img.rule34.xxx/images/" | post_url = "https://img.rule34.xxx/images/" | ||||
return await ctx.invoke(self.gelbooru_clone, base_url=base_url, post_url=post_url, tags=tags) | return await ctx.invoke(self.gelbooru_clone, base_url=base_url, post_url=post_url, tags=tags) | ||||
@roxbot.checks.is_nfsw_enabled() | |||||
@commands.is_nsfw() | |||||
@commands.command() | @commands.command() | ||||
async def gelbooru(self, ctx, *, tags=""): | async def gelbooru(self, ctx, *, tags=""): | ||||
""" | """ | ||||
post_url = "https://simg3.gelbooru.com/images/" | post_url = "https://simg3.gelbooru.com/images/" | ||||
return await ctx.invoke(self.gelbooru_clone, base_url=base_url, post_url=post_url, tags=tags) | return await ctx.invoke(self.gelbooru_clone, base_url=base_url, post_url=post_url, tags=tags) | ||||
@commands.has_permissions(manage_channels=True) | |||||
@commands.command() | @commands.command() | ||||
async def nsfw(self, ctx, setting, channel: typing.Optional[discord.TextChannel] = None, *, changes=None): | |||||
async def nsfw(self, ctx, setting, *, changes=None): | |||||
"""Edits settings for the nsfw cog and other nsfw commands. | """Edits settings for the nsfw cog and other nsfw commands. | ||||
If nsfw is enabled and nsfw channels are added, the bot will only allow nsfw commands in the specified channels. | If nsfw is enabled and nsfw channels are added, the bot will only allow nsfw commands in the specified channels. | ||||
elif setting == "disable": | elif setting == "disable": | ||||
nsfw["enabled"] = 0 | nsfw["enabled"] = 0 | ||||
await ctx.send("'nsfw' was disabled :cry:") | await ctx.send("'nsfw' was disabled :cry:") | ||||
elif setting == "addchannel": | |||||
if not channel and not changes: | |||||
channel = ctx.channel | |||||
if channel.id not in nsfw["channels"]: | |||||
nsfw["channels"].append(channel.id) | |||||
await ctx.send("'{}' has been added to the nsfw channel list.".format(channel.name)) | |||||
else: | |||||
return await ctx.send("'{}' is already in the list.".format(channel.name)) | |||||
elif setting == "removechannel": | |||||
if not channel and not changes: | |||||
channel = ctx.channel | |||||
try: | |||||
nsfw["channels"].remove(channel.id) | |||||
await ctx.send("'{}' has been removed from the nsfw channel list.".format(channel.name)) | |||||
except ValueError: | |||||
return await ctx.send("That role was not in the list.") | |||||
elif setting == "addbadtag": | elif setting == "addbadtag": | ||||
if changes not in nsfw["blacklist"]: | if changes not in nsfw["blacklist"]: | ||||
nsfw["blacklist"].append(changes) | nsfw["blacklist"].append(changes) |
x += 1 | x += 1 | ||||
# Check if post is NSFW, and if it is and this channel doesn't past the NSFW check, then return with the error message. | # Check if post is NSFW, and if it is and this channel doesn't past the NSFW check, then return with the error message. | ||||
if (choice["over_18"] and not roxbot.checks.nsfw_predicate(ctx)) and isinstance(ctx.channel, discord.TextChannel): | |||||
if (choice["over_18"] and not ctx.channel.is_nsfw()) and isinstance(ctx.channel, discord.TextChannel): | |||||
return await ctx.send("This server/channel doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") | return await ctx.send("This server/channel doesn't have my NSFW stuff enabled. This extends to posting NFSW content from Reddit.") | ||||
if not url: # If no image posts could be found with the for loop. | if not url: # If no image posts could be found with the for loop. | ||||
return await ctx.send("I couldn't find any images from that subreddit.") | return await ctx.send("I couldn't find any images from that subreddit.") | ||||
subreddit = "gaysoundsshitposts" | subreddit = "gaysoundsshitposts" | ||||
return await ctx.invoke(self.subreddit, subreddit=subreddit) | return await ctx.invoke(self.subreddit, subreddit=subreddit) | ||||
@commands.command(hidden=True, name="subreddit_dryrun") | |||||
async def _subreddit_test(self, ctx, url): | |||||
return await ctx.send(await parse_url(url)) | |||||
def setup(bot_client): | def setup(bot_client): | ||||
bot_client.add_cog(Reddit(bot_client)) | bot_client.add_cog(Reddit(bot_client)) |