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; }
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); }