fixed issue with e621 limiting searches to 6 tags and loading all of the default banned tags and added some warningstags/v2.1.0
@@ -1161,6 +1161,9 @@ Posts a random image from [e621](https://e621.net) using the tags you provide. T | |||
!!! warning | |||
This command will only work in channels marked NSFW or DMs. | |||
!!! warning | |||
[e621](https://e621.net) limits searches to 6 tags via the API. Blacklisting a lot of tags may break this command. | |||
Command Structure: |
@@ -55,7 +55,6 @@ class NFSW: | |||
banned_tags = tag_blacklist(ctx.guild) | |||
else: | |||
banned_tags = "" | |||
banned_tags += " -loli -shota -shotacon -lolicon -cub" # Removes TOS breaking content from the search | |||
post = await roxbot.utils.danbooru_clone_api_req( | |||
ctx.channel, | |||
@@ -76,6 +75,7 @@ class NFSW: | |||
@commands.command() | |||
async def e621(self, ctx, *, tags=""): | |||
"""Posts a random image from https://e621.net using the tags you provide. Tags can be anything you would use to search the site normally like author and ratings. | |||
https://e621.net limits searches to 6 tags via the API. Blacklisting a lot of tags may break this command. | |||
Examples: | |||
# Post a random image | |||
;e621 |
@@ -30,8 +30,7 @@ import argparse | |||
import discord | |||
from discord.ext import commands | |||
from roxbot import http, config | |||
from roxbot import guild_settings | |||
from roxbot import http, config, exceptions, guild_settings | |||
from roxbot.enums import EmbedColours | |||
@@ -194,9 +193,20 @@ async def danbooru_clone_api_req(channel, base_url, endpoint_url, cache=None, ta | |||
banned tags to append to the search. Separated by spaces with a - in front to remove them from search results. | |||
""" | |||
limit = "150" | |||
tags = tags + banned_tags | |||
is_e621_site = bool("e621" in base_url or "e926" in base_url) | |||
if is_e621_site: | |||
banned_tags += " -cub" # Removes TOS breaking content from the search | |||
tags = tags + banned_tags | |||
if len(tags.split()) > 6: | |||
raise exceptions.UserError("Too many tags given for this site.") | |||
else: | |||
banned_tags += " -loli -shota -shotacon -lolicon -cub" # Removes TOS breaking content from the search | |||
tags = tags + banned_tags | |||
page_number = str(random.randrange(20)) | |||
if "konachan" in base_url or "e621" in base_url or "e926" in base_url: | |||
if "konachan" in base_url or is_e621_site: | |||
page = "&page=" | |||
else: | |||
page = "&pid=" |