From 54176f9136970c117ce86a7ad21647e3a506f26a Mon Sep 17 00:00:00 2001 From: FlorianDahn Date: Sun, 5 Apr 2020 23:47:27 +0700 Subject: [PATCH] Update SessionBase.cs - adding method to get User Sessions and Group Sessions --- TelegramBotBase/SessionBase.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/TelegramBotBase/SessionBase.cs b/TelegramBotBase/SessionBase.cs index a66c61f..0da6128 100644 --- a/TelegramBotBase/SessionBase.cs +++ b/TelegramBotBase/SessionBase.cs @@ -90,5 +90,22 @@ namespace TelegramBotBase } } + /// + /// Returns all active User Sessions. + /// + /// + public List GetUserSessions() + { + return this.SessionList.Where(a => a.Key > 0).Select(a => a.Value).ToList(); + } + + /// + /// Returns all active Group Sessions. + /// + /// + public List GetGroupSessions() + { + return this.SessionList.Where(a => a.Key < 0).Select(a => a.Value).ToList(); + } } }