Explorar o código

Fix new user link connection

Tigran %!s(int64=4) %!d(string=hai) anos
pai
achega
03eceabe45

+ 0 - 1
MafiaTelegramBot/Controllers/RoomController.cs

@@ -1,4 +1,3 @@
-using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;

+ 1 - 2
MafiaTelegramBot/DataBase/EntityDao/UserDao.cs

@@ -1,4 +1,3 @@
-using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
@@ -11,7 +10,7 @@ namespace MafiaTelegramBot.DataBase.EntityDao
     public static class UserDao
     {
         private static readonly MafiaDataBase DataBase = MafiaDataBase.GetInstance();
-        private static readonly Dictionary<long, Player> ActiveUsers = new();
+        public static readonly Dictionary<long, Player> ActiveUsers = new();
         public static async Task<Player> GetPlayerById(long id)
         {
             if (ActiveUsers.ContainsKey(id)) return ActiveUsers[id];

+ 1 - 0
MafiaTelegramBot/Models/Commands/StartCommand.cs

@@ -36,6 +36,7 @@ namespace MafiaTelegramBot.Models.Commands
                 Id = UserId, ChatId = ChatId, Username = username, NickName =  $"{firstName} {lastName}"
             };
             await UserDao.Update(user);
+            UserDao.ActiveUsers.Add(user.Id, user);
             if (command.Length <= 1)
                 return await Bot.SendWithMarkdown2(ChatId, strings.start_message, Keyboards.MainMenu);
             var resultCode = await RoomController.ConnectToGame(user, command[1]);