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
async def prepare_bot(loop): await database.setup() bot = Xenon(loop=loop) return bot
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")
async def prepare_bot(loop): logger.setup() return Xenon(loop=loop)
async def prepare_bot(_loop): return Xenon(loop=_loop)