示例#1
0
        public BotSession CreateSession(MainBot bot, ushort invokerId)
        {
            if (bot == null)
                throw new ArgumentNullException(nameof(bot));

            if (ExistsSession(invokerId))
                return GetSession(MessageTarget.Private, invokerId);
            ClientData client = bot.QueryConnection.GetClientById(invokerId);
            if (client == null)
                throw new SessionManagerException("Could not find the requested client.");
            var newSession = new PrivateSession(bot, client);
            openSessions.Add(newSession);
            return newSession;
        }
示例#2
0
        public BotSession CreateSession(MainBot bot, ushort invokerId)
        {
            if (bot == null)
            {
                throw new ArgumentNullException(nameof(bot));
            }

            if (ExistsSession(invokerId))
            {
                return(GetSession(MessageTarget.Private, invokerId));
            }
            ClientData client = bot.QueryConnection.GetClientById(invokerId);

            if (client == null)
            {
                throw new SessionManagerException("Could not find the requested client.");
            }
            var newSession = new PrivateSession(bot, client);

            openSessions.Add(newSession);
            return(newSession);
        }