示例#1
0
        public static async Task <bool> Start(BotStartupConfig config)
        {
            if (connecting || session.Connected)
            {
                return(false);
            }
            else
            {
                connecting = true;
            }
            MiraiHttpSessionOptions options = new MiraiHttpSessionOptions(config.host, config.port, config.authKey);

            try
            {
                await session.ConnectAsync(options, config.qqID);
            }
            catch
            {
                connecting = false;
                return(false);
            }
            if (session.Connected)
            {
                session.AddPlugin(new MainPlugin());
                await BotCore.Init(session, config);

                connecting = false;
                return(true);
            }
            else
            {
                connecting = false;
                return(false);
            }
        }