Beispiel #1
0
async def switch_session(event, msg):
    bot = get_bot()
    kill_current_session(event)
    new_event = replace_event_msg(event, msg)
    await bot.send(new_event, "re: " + msg)
    event["to_me"] = True
    asyncio.ensure_future(handle_message(bot, new_event))
Beispiel #2
0
async def switch(session: CommandSession):
    parser = ArgumentParser(session=session, usage=USAGE)
    parser.add_argument('-r',
                        '--repeat-message',
                        action='store_true',
                        default=False)
    parser.add_argument('message')
    args = parser.parse_args(session.argv)

    kill_current_session(session.ctx)

    msg = Message(args.message)
    if args.repeat_message:
        await session.send(msg)

    ctx = session.ctx.copy()
    ctx['message'] = msg
    ctx['to_me'] = True  # ensure to_me
    asyncio.ensure_future(handle_message(session.bot, ctx))
Beispiel #3
0
async def _(session: CommandSession):
    kill_current_session(session.event)
    await session.send('已强制关闭当前正在运行的会话')
Beispiel #4
0
async def kill(session: CommandSession):
    await session.send("*DeltaBot*掉出了这个世界")
    command.kill_current_session(session.event)