Remove bad words from the danbooru search. Fixes #24
This commit is contained in:
parent
534301ebec
commit
895dbb345d
@ -4,7 +4,7 @@ services:
|
|||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- apk add --no-cache python3
|
- apk add --no-cache python3
|
||||||
- pip3 install pylint requests discord.py docker pybooru pylint wolframalpha
|
- pip3 install pylint requests discord.py docker pylint wolframalpha
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
|
@ -2,7 +2,7 @@ FROM python:3.6.2-alpine3.6
|
|||||||
LABEL name="Dragon Bot"
|
LABEL name="Dragon Bot"
|
||||||
RUN apk update && apk add --no-cache docker
|
RUN apk update && apk add --no-cache docker
|
||||||
|
|
||||||
RUN pip install requests discord.py docker pybooru wolframalpha
|
RUN pip install requests discord.py docker wolframalpha
|
||||||
ADD app /app
|
ADD app /app
|
||||||
|
|
||||||
CMD python app/dragon-bot.py
|
CMD python app/dragon-bot.py
|
@ -2,7 +2,7 @@ FROM python:3.6.2-alpine3.6
|
|||||||
LABEL name="Dragon Bot Test environment"
|
LABEL name="Dragon Bot Test environment"
|
||||||
RUN apk update && apk add --no-cache vim docker
|
RUN apk update && apk add --no-cache vim docker
|
||||||
|
|
||||||
RUN pip install requests discord.py docker pybooru pylint wolframalpha
|
RUN pip install requests discord.py docker pylint wolframalpha
|
||||||
ADD app /app
|
ADD app /app
|
||||||
|
|
||||||
RUN printf "\n\nTesting your python code for errors\n\n" && \
|
RUN printf "\n\nTesting your python code for errors\n\n" && \
|
||||||
|
60
app/lewds.py
60
app/lewds.py
@ -2,69 +2,19 @@ import random
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
import get_from_reddit
|
import get_from_reddit
|
||||||
from pybooru import Danbooru
|
|
||||||
|
|
||||||
|
|
||||||
def get_from_danbooru(boards):
|
def get_from_danbooru(boards):
|
||||||
"""
|
"""
|
||||||
get_from_danbooru(boards)
|
get_from_danbooru(boards)
|
||||||
|
|
||||||
returns a URL to an image on danbooru that matches a random tag
|
returns a URL to an image on danbooru
|
||||||
defined in the tag_list list
|
|
||||||
"""
|
"""
|
||||||
booru = Danbooru('danbooru')
|
file_path = requests.get(
|
||||||
tag_list = [
|
'https://danbooru.donmai.us/posts/random.json?tags=rating%3Aexplicit'
|
||||||
'1girl',
|
).json()['large_file_url']
|
||||||
'2girls',
|
|
||||||
'ass_visible_through_thighs',
|
|
||||||
'bare_legs'
|
|
||||||
'bikini',
|
|
||||||
'black_bikini',
|
|
||||||
'black_panties',
|
|
||||||
'blue_eyes',
|
|
||||||
'bra_pull',
|
|
||||||
'bra',
|
|
||||||
'breasts',
|
|
||||||
'cameltoe',
|
|
||||||
'clevage',
|
|
||||||
'condom_in_mouth',
|
|
||||||
'condom',
|
|
||||||
'from_below',
|
|
||||||
'gloves',
|
|
||||||
'highleg_bikini',
|
|
||||||
'highleg',
|
|
||||||
'highres',
|
|
||||||
'horns',
|
|
||||||
'large_breasts',
|
|
||||||
'leash',
|
|
||||||
'medium_breasts'
|
|
||||||
'miniskirt',
|
|
||||||
'nier_automata',
|
|
||||||
'nier',
|
|
||||||
'nipples',
|
|
||||||
'partially_visible_vulva',
|
|
||||||
'pencil_skirt',
|
|
||||||
'pussy_juice',
|
|
||||||
'pussy',
|
|
||||||
'skirt',
|
|
||||||
'small_breasts',
|
|
||||||
'thong_bikini',
|
|
||||||
'topless',
|
|
||||||
'wet_clothes',
|
|
||||||
'wet_panties',
|
|
||||||
'wet',
|
|
||||||
]
|
|
||||||
|
|
||||||
tag = random.choice(tag_list)
|
|
||||||
return "https://danbooru.donmai.us{}".format(
|
|
||||||
random.choice(
|
|
||||||
booru.post_list(
|
|
||||||
limit=500,
|
|
||||||
tags=tag,
|
|
||||||
random=True,
|
|
||||||
)
|
|
||||||
)['large_file_url'])
|
|
||||||
|
|
||||||
|
return "https://danbooru.donmai.us{}".format(file_path)
|
||||||
|
|
||||||
def get_lewd(channel_name):
|
def get_lewd(channel_name):
|
||||||
if 'nsfw' in channel_name:
|
if 'nsfw' in channel_name:
|
||||||
|
@ -53,4 +53,4 @@ def cleanup_permissions(user):
|
|||||||
|
|
||||||
Who has rights to make dragon-bot purge its messages
|
Who has rights to make dragon-bot purge its messages
|
||||||
"""
|
"""
|
||||||
return is_admin(user) or user.id == '144986109804412928'
|
return is_admin(user) or is_mod(user)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user