<commit_before>from plugin import Plugin
from config import cmd_nhentai
from config import cmd_ehentai
from config import cmd_gelbooru
from config import cmd_rule34
from config import cmd_e621
from config import cmd_hentaims
from utils import create_logger
from lxml import html
import requests
import xml.etree.ElementTree
import random

class Hentai(Plugin):
    is_global = True
    log = create_logger('hentai')

    async def on_message(self, message, pfx):
        if message.content.startswith(pfx + cmd_gelbooru):
            await self.client.send_typing(message.channel)
            cmd_name = 'GelBooru'
            self.log.info('\nUser %s [%s] on server %s [%s], used the ' + cmd_name + ' command on #%s channel',
                          message.author,
                          message.author.id, message.server.name, message.server.id, message.channel)
            tags = message.content[len(pfx) + len(cmd_gelbooru) + 1:]
            if tags == '':
                tags = 'nude'
            else:
                pass
            gelbooru_url = 'http://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=' + tags.replace(' ', '+')
            data = requests.get(gelbooru_url)
            posts = html.fromstring(data.content)
            choice = random.choice(posts)
            await self.client.send_message(message.channel, choice.attrib['file_url'])

        elif message.content.startswith(pfx + cmd_nhentai + ' '):
            await self.client.send_typing(message.channel)
            cmd_name = 'NHentai'
            self.log.info('\nUser %s [%s] on server %s [%s], used the ' + cmd_name + ' command on #%s channel',
                          message.author,
                          message.author.id, message.server.name, message.server.id, message.channel)
            #stuff
        elif message.content.startswith(pfx + cmd_ehentai + ' '):<commit_msg>Temp Hentai safeguard<commit_after>from plugin import Plugin
from config import cmd_nhentai
from config import cmd_ehentai
from config import cmd_gelbooru
from config import cmd_rule34
from config import cmd_e621
from config import cmd_hentaims
from utils import create_logger
from lxml import html
import requests
import xml.etree.ElementTree
import random

class Hentai(Plugin):
    is_global = True
    log = create_logger('hentai')

    async def on_message(self, message, pfx):
        if message.content.startswith(pfx + cmd_gelbooru):
            await self.client.send_typing(message.channel)
            cmd_name = 'GelBooru'
            self.log.info('\nUser %s [%s] on server %s [%s], used the ' + cmd_name + ' command on #%s channel',
                          message.author,
                          message.author.id, message.server.name, message.server.id, message.channel)
            tags = message.content[len(pfx) + len(cmd_gelbooru) + 1:]
            if tags == '':
                tags = 'nude'
            else:
                pass
            gelbooru_url = 'http://gelbooru.com/index.php?page=dapi&s=post&q=index&tags=' + tags.replace(' ', '+')
            data = requests.get(gelbooru_url)
            posts = html.fromstring(data.content)
            choice = random.choice(posts)
            if message.server.id == '92827879448002560':
                if message.channel.id == '216786478863220737':
                    await self.client.send_message(message.channel, choice.attrib['file_url'])
                else:
                    await self.client.send_message(message.channel, 'This is not the time and place to use this~ ;3\mTriTri would murder Alex\'s face off!')
            else:
                await self.client.send_message(message.channel, choice.attrib['file_url'])
        elif message.content.startswith(pfx + cmd_nhentai + ' '):
            await self.client.send_typing(message.channel)
            cmd_name = 'NHentai'
            self.log.info('\nUser %s [%s] on server %s [%s], used the ' + cmd_name + ' command on #%s channel',
                          message.author,
                          message.author.id, message.server.name, message.server.id, message.channel)
            #stuff
        elif message.content.startswith(pfx + cmd_ehentai + ' '):
{'fraction_non_alphanumeric': 0.10550130983567516, 'fraction_numerical': 0.011431293165039295, 'mean_word_length': 2.265940902021773, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '719462', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1265, 'n_words': 293}