Uhhh changes????
This commit is contained in:
parent
086e3e377a
commit
d3f4e3d1f3
|
@ -152,5 +152,5 @@ I | X
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup():
|
def setup(bot):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -13,7 +13,7 @@ import html2text
|
||||||
import re
|
import re
|
||||||
from urllib.parse import quote_plus
|
from urllib.parse import quote_plus
|
||||||
|
|
||||||
from extensions.models import SearchExceptions
|
from extensions.models import searchexceptions
|
||||||
from extensions.models.regex import nono_re
|
from extensions.models.regex import nono_re
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class Search(commands.Cog, name="Basic"):
|
||||||
|
|
||||||
# NSFW Filtering
|
# NSFW Filtering
|
||||||
if nono_re.match(query) and not is_nsfw:
|
if nono_re.match(query) and not is_nsfw:
|
||||||
raise SearchExceptions.SafesearchFail('Query had NSFW.')
|
raise searchexceptions.SafesearchFail('Query had NSFW.')
|
||||||
|
|
||||||
base = "https://api.qwant.com/api"
|
base = "https://api.qwant.com/api"
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ class Search(commands.Cog, name="Basic"):
|
||||||
await self._basic_search(
|
await self._basic_search(
|
||||||
ctx, ctx.message.content[len(ctx.prefix):]
|
ctx, ctx.message.content[len(ctx.prefix):]
|
||||||
)
|
)
|
||||||
except SearchExceptions.SafesearchFail:
|
except searchexceptions.SafesearchFail:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
"**Sorry!** That query included language "
|
"**Sorry!** That query included language "
|
||||||
"we cannot accept in a non-NSFW channel. "
|
"we cannot accept in a non-NSFW channel. "
|
||||||
|
|
4
main.py
4
main.py
|
@ -18,7 +18,7 @@ import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import rethinkdb
|
import rethinkdb
|
||||||
|
|
||||||
from extensions.models import SearchExceptions
|
from extensions.models import searchexceptions
|
||||||
|
|
||||||
|
|
||||||
class Bot(commands.Bot):
|
class Bot(commands.Bot):
|
||||||
|
@ -270,7 +270,7 @@ async def on_command_error(ctx, error):
|
||||||
f"**Missing Argument!** A `{error.param.name}` is needed."
|
f"**Missing Argument!** A `{error.param.name}` is needed."
|
||||||
)
|
)
|
||||||
|
|
||||||
elif isinstance(error, SearchExceptions.SafesearchFail):
|
elif isinstance(error, searchexceptions.SafesearchFail):
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
"**Sorry!** That query included language "
|
"**Sorry!** That query included language "
|
||||||
"we cannot accept in a non-NSFW channel. "
|
"we cannot accept in a non-NSFW channel. "
|
||||||
|
|
|
@ -2,6 +2,8 @@ import pytest
|
||||||
|
|
||||||
import discord.ext.test as dpytest
|
import discord.ext.test as dpytest
|
||||||
|
|
||||||
|
import extensions.models.regex
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_regex():
|
async def test_regex():
|
||||||
# bot = main.Bot()
|
# bot = main.Bot()
|
||||||
|
|
Loading…
Reference in New Issue