示例#1
0
def get_help(message):
    """
	Return the help file located in ./docs/help
	:param message: <Discord.message object>
	:return: <String> The local help file
	"""
    increment_usage(message.guild, 'help')
    return wrap(fetch_file('help', 'dict'), 1990)
示例#2
0
def get_help(author):
    """
	Get the help file in ./docs/help
	:param message: <Discord.message.author object>
	:return: <String> The local help file
	"""
    text = fetch_file('help', 'gif')
    banner = Embed(title='General Help', description=text)
    return banner
示例#3
0
async def get_help(message):
    """
	Get the help file in ./docs/help 
	:param message: <Discord.message.author object>
	:return: <String> The local help file
	"""
    text = fetch_file('help', 'quotes')
    if not await is_admin(message.author, message):
        text = text.split('For Admins:')[0]
    banner = Embed(title='General Help', description=text)
    return banner
示例#4
0
文件: main.py 项目: EanNewton/FamBot
async def on_guild_join(guild):
    if VERBOSE >= 1:
        print('[+] Joined a new guild: {}'.format(guild.name))
    config_file = config_create(guild)
    banner = 'Hello {}! \n{}'.format(guild.owner.mention,
                                     fetch_file('help', 'welcome'))
    await guild.owner.send(
        file=discord.File('{}/docs/header.png'.format(DEFAULT_DIR)))
    await guild.owner.send(banner, file=discord.File(config_file))
    tquote.setup()
    util_setup()
示例#5
0
async def get_help(message):
    """
	Get the command help file from ./docs/help
	:param message: <Discord.message object>
	:return: <String> Containing help for the user's available options or list of locations
	"""
    increment_usage(message.guild, 'help')
    args = message.content.split()
    banner = Embed(title='Schedule')

    if len(args) < 3:
        # Get general help
        raw = fetch_file('help', 'schedule')
        if not await is_admin(message.author, message):
            raw = raw.split('For Admins:')[0]
        banner.add_field(name='Help', value=raw)
    else:
        # Get list of cities or continents
        raw = fetch_file('locales', args[2].lower())
        banner.add_field(name='Locales in {}'.format((args[2].lower())),
                         value=raw)

    return banner
示例#6
0
async def get_help(result):
    increment_usage(result["message"].guild, 'help')
    help_ = fetch_file('help', 'general')
    if not await is_admin(result["message"].author, result["message"]):
        help_ = help_.split('For Admins:')[0]

    banner = Embed(title='General Help', description=help_)
    banner.add_field(name='Help support this bot!',
                     value='All donations go to development and server costs.',
                     inline=False)
    banner.add_field(name='PayPal', value=help_general['paypal'])
    # banner.add_field(name='Patreon', value=help_general['patreon'])
    banner.add_field(name='More Information',
                     value='This bot is open source, find it at: {}'.format(
                         help_general['github']))
    banner.add_field(name='Invite the bot to your server.',
                     value=help_general['invite'],
                     inline=False)

    result["embed"] = banner
    return result
示例#7
0
def get_help(message):
    """
    Get the command help file from ./docs/help
    :param message: <Discord.message object>
    :return: <String> Containing help for the user's available options or list of locations
    """
    increment_usage(message.guild, 'help')
    custom = ''
    try:
        guild_commands = custom_commands[message.guild.id]
        banner = Embed(title='Custom Command Help',
                       description=fetch_file('help', 'custom'))
        for name, value in guild_commands.items():
            custom = '{}`{}`: {}\n'.format(custom, name, value)
        available = Embed(
            title='Custom commands available in this server are:',
            description=custom)
        # banner.add_field(name='Custom commands available in this server are:', value=custom)
        return None, [banner, available]
    except Exception as e:
        if VERBOSE >= 0:
            print('[!] Exception in get help custom {}'.format(e))
        pass
示例#8
0
文件: tstat.py 项目: EanNewton/FamBot
def get_help(message):
    increment_usage(message.guild, 'help')
    banner = Embed(title='Stats Help', description=fetch_file('help', 'stats'))
    return None, banner
示例#9
0
async def wolfram(message):
    """
	Return an image based response from the Wolfram Alpha API
	:param message: <Discord.message object> 
	:return: <str> Banner or None
	"""
    increment_usage(message.guild, 'wolf')

    args = message.content.split()
    banner = Embed(title="Wolfram Alpha")
    try:
        if len(args) > 1:
            if args[1].lower() in {'simple', 'txt', 'text', 'textual'}:
                query_st = quote_plus(' '.join(args[2:]))
                query = URL_WOLF_TXT.format(WOLFRAM, query_st)

                async with aiohttp.ClientSession() as session:
                    async with session.get(query) as resp:
                        if resp.status == 200:
                            text = await resp.read()
                        elif resp.status == 501:
                            return 'Wolfram cannot interpret your request.'
                        else:
                            return [
                                '[!] Wolfram Server Status {}'.format(
                                    resp.status), None
                            ]

                text = text.decode('UTF-8')
                banner.add_field(name=' '.join(args[2:]), value=text)
                return banner

            elif args[1].lower() in {
                    'complex', 'graphic', 'graphical', 'image', 'img', 'gif'
            }:
                query_st = quote_plus(' '.join(args[2:]))
                query = URL_WOLF_IMG.format(WOLFRAM, query_st)
                file_path = '{}/log/wolf/{}.gif'.format(
                    DEFAULT_DIR, message.id)

                async with aiohttp.ClientSession() as session:
                    async with session.get(query) as resp:
                        if resp.status == 200:
                            f = await aiofiles.open(file_path, mode='wb')
                            await f.write(await resp.read())
                            await f.close()
                            return [None, file_path]
                        elif resp.status == 501:
                            return [
                                'Wolfram cannot interpret your request.', None
                            ]
                        else:
                            return [
                                '[!] Wolfram Server Status {}'.format(
                                    resp.status), None
                            ]

        banner = Embed(title='Wolfram Help',
                       description=fetch_file('help', 'wolfram'))
        return banner
    except Exception as e:
        if VERBOSE >= 0:
            print('[!] Wolfram failed to process command on: {}'.format(
                message.content))
            print('[!] {}'.format(e))
        return None