示例#1
0
async def prepare_bot(loop):
    opts, args = getopt.getopt(sys.argv[1:], "", ["shard_count=", "shard_ids="])

    arguments = {}
    for opt, arg in opts:
        opt = opt.strip("-")
        if opt == "shard_count":
            arg = int(arg)

        if opt == "shard_ids":
            arg = [int(id) for id in arg.split(",")]

        arguments[opt] = arg

    bot = Xenon(loop=loop, **arguments)

    return bot
示例#2
0
async def prepare_bot(loop):
    await database.setup()
    bot = Xenon(loop=loop)

    return bot
示例#3
0
from bot import Xenon
from os import environ as env

bot = Xenon(prefix=env.get("PREFIX") or "#!",
            mongo_url=env.get("MONGO_URL") or "mongodb://localhost",
            rabbit_url=env.get("RABBIT_URL")
            or "amqp://*****:*****@localhost/",
            redis_url=env.get("REDIS_URL") or "redis://localhost/",
            redis_db=int(env.get("REDIS_DB") or "0"))
bot.run(token=env.get("TOKEN"), shared_queue="main")
示例#4
0
async def prepare_bot(loop):
    logger.setup()
    return Xenon(loop=loop)
示例#5
0
async def prepare_bot(_loop):
    return Xenon(loop=_loop)