Beispiel #1
0
                          ConverterFlag().update_by_keys(name=True)),
        FlaggedAnnotation('role',
                          ConverterFlag().update_by_keys(name=True)),
    ),
):

    if isinstance(entity, UserBase):
        result = 'user'
    elif isinstance(entity, ChannelBase):
        result = 'channel'
    else:
        result = 'role'

    await client.message_create(message.channel, result)


async def owner_only_handler(client, message, command, check):
    await client.message_create(
        message.channel,
        f'You must be the owner of the bot to use the `{command}` command.',
    )


@NekoBot.commands(checks=[checks.owner_only(handler=owner_only_handler)])
async def owner(client, message):
    await client.message_create(message.channel,
                                f'My masuta is {client.owner:f} !')


start_clients()
Beispiel #2
0
del config_path

import config

# Load hata lib

hata_path = config.HATA_PATH
if (hata_path is not None) and (hata_path not in sys.path):
    sys.path.append(hata_path)

del hata_path

import hata
# Import things depending on settings and which file is started up.
#
# As self host, turn `RUN_WEBAPP_AS_MAIN` on and run this file.
#
# If hosting, wsgi will import this file, so the bots will not start up. Those need to be started up separatedly by an
# always running task.

if __name__ == '__main__':
    import bots
    hata.start_clients()

    if config.RUN_WEBAPP_AS_MAIN:
        from web import WEBAPP
        WEBAPP.run()
else:
    hata.KOKORO.stop()
    from web import WEBAPP