diff --git a/Experiments/ExternalActionManager/DemoBot/CustomFormBaseMessageLoop.cs b/Experiments/ExternalActionManager/DemoBot/CustomFormBaseMessageLoop.cs index f2f1543..6bcdd3d 100644 --- a/Experiments/ExternalActionManager/DemoBot/CustomFormBaseMessageLoop.cs +++ b/Experiments/ExternalActionManager/DemoBot/CustomFormBaseMessageLoop.cs @@ -22,7 +22,7 @@ namespace DemoBot public ExternalActionManager ExternalActionManager { get; set; } - public async Task MessageLoop(BotBase bot, DeviceSession session, UpdateResult ur, MessageResult mr) + public async Task MessageLoop(BotBase bot, DeviceSession s, UpdateResult ur, MessageResult mr) { var update = ur.RawData; @@ -34,6 +34,9 @@ namespace DemoBot return; } + //Remove unecessary parameter from method call in the future + var session = ur.Device; + //Is this a bot command ? if (mr.IsFirstHandler && mr.IsBotCommand && bot.IsKnownBotCommand(mr.BotCommand)) { diff --git a/TelegramBotBase/BotBase.cs b/TelegramBotBase/BotBase.cs index 05f8053..fd73a2c 100644 --- a/TelegramBotBase/BotBase.cs +++ b/TelegramBotBase/BotBase.cs @@ -115,12 +115,13 @@ public sealed class BotBase if (ds == null) { ds = await Sessions.StartSession(e.DeviceId); - e.Device = ds; ds.LastMessage = e.RawData.Message; - OnSessionBegins(new SessionBeginEventArgs(e.DeviceId, ds)); + OnSessionBegins(new SessionBeginEventArgs(e.DeviceId, ds)); } + e.Device = ds; + var mr = new MessageResult(e.RawData); var i = 0; @@ -210,6 +211,7 @@ public sealed class BotBase try { var ds = Sessions.GetSession(deviceId); + e.Device = ds; await MessageLoopFactory.MessageLoop(this, ds, new UpdateResult(e.UpdateData, ds), e);