def do(self, ):
     lang_list = self.langs.split("+")
     lang_chars = ""
     for lang in lang_list:
         lang_module = "%s" % lang
         lang_module_data = __import__(lang_module, fromlist=[''])
         lang_chars += lang_module_data.data
     trim_string(lang_chars)
     return lang_chars
예제 #2
0
async def run(message, command, thread_id: int):
    if command not in {
            'post',
            'thread',
    }:
        raise TypeError

    if message.guild and message.channel.id not in {
            718139355813904484,  # forum threads channel
            718076311150788649,  # bot-commands
            719518839171186698,  # staff-bot-commands
    }:
        return

    if check_forum_ratelimit(message.author.id):
        return await message.send('Stop spamming the command, nerd')
    add_forum_ratelimit(message.author.id)

    print('ok')
    async with message.channel.typing():
        thread = await forums.get_thread(thread_id)
        if not thread:
            return await message.send('Invalid thread.')
        body_trimmed = trim_string(thread['body'])
        embed = discord.Embed(title=thread['title'],
                              description=body_trimmed,
                              url=thread['url'])
        embed.set_author(
            name=thread['author']['name'],
            url=thread['author']['url'],
            icon_url=thread['author']['avatar_url'],
        )
        if thread['image']:
            embed['image'] = {'url': thread['image']}
        await message.channel.send(embed=embed)
예제 #3
0
async def run(message, thread_id: int):
    'Show the contents of a Hypixel forums thread from its id'

    if check_forum_ratelimit(message.author.id):
        return await message.send('Stop spamming the command, nerd')
    add_forum_ratelimit(message.author.id)

    print('ok')
    async with message.channel.typing():
        thread = await forums.get_thread(thread_id)
        if not thread:
            return await message.send('Invalid thread.')
        body_trimmed = trim_string(thread['body'])
        embed = discord.Embed(title=thread['title'],
                              description=body_trimmed,
                              url=thread['url'])
        embed.set_author(
            name=thread['author']['name'],
            url=thread['author']['url'],
            icon_url=thread['author']['avatar_url'],
        )
        if thread['image']:
            embed.set_image(url=thread['image'])
        await message.channel.send(embed=embed)
def func_num():
    data1 = u'''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789'''
    data1 = trim_string(data1)
    return data1
def func1():
    data1 = trim_string(data)
    return data1
예제 #6
0
# -*- coding: utf-8 -*-

from utils import trim_string

data = u'''
abcdefghijklmnopqrstuvwxyz
'''

data = trim_string(data)