Tigran 4 years ago
parent
commit
24df6bf70d

+ 1 - 1
MafiaTelegramBot/Controllers/RoomController.cs

@@ -73,7 +73,7 @@ namespace MafiaTelegramBot.Controllers
                 UserDao.GetPlayerById(player.Id).Result.StartTimer();
                 
                 var message = OpenedGames[roomKey].Owner.Id == player.Id
-                    ? $"{player.NickName} \\({strings.room_owner}\\) {strings.leave_from_game}"
+                    ? $"{player.NickName} ({strings.room_owner}) {strings.leave_from_game}"
                     : $"{player.NickName} {strings.leave_from_game}";
                 await OpenedGames[roomKey].PlayersCh.SendExcept(player.Id, message);
                 if (OpenedGames[roomKey].Players.Count >= 0) return ResultCode.CodeOk;

+ 2 - 0
MafiaTelegramBot/Game/GameRooms/GameRoom.GameProcess.cs

@@ -252,6 +252,8 @@ namespace MafiaTelegramBot.Game.GameRooms
                             break;
                     }
                 }
+                VoteUpList.Clear();
+                VoteKillList.Clear();
             });
         }
 

+ 1 - 2
MafiaTelegramBot/Game/GameRooms/GameRoom.Role.cs

@@ -81,13 +81,13 @@ namespace MafiaTelegramBot.Game.GameRooms
 
             public async Task SpeakAction(int seconds = 60, bool enableTimer = false)
             {
-                TalkingActionComplete.Reset();
                 await Room.PlayersCh.SendTo(Player.ChatId, $"{strings.your_turn}", Keyboard.InGamePlayerMenuWithEndTurn);
                 Player.IsSpeaker = true;
                 var timer = new Timer(seconds * 1000) {AutoReset = false};
                 timer.Elapsed += (_, _) => TalkingActionComplete.Set();
                 if (Room.TimerEnabled || enableTimer) timer.Start();
                 TalkingActionComplete.WaitOne();
+                TalkingActionComplete.Reset();
                 if (Room.TimerEnabled || enableTimer) timer.Stop();
                 await Room.PlayersCh.SendTo(Player.ChatId, strings.your_turn_ended, Keyboard.InGamePlayerMenu);
                 Player.IsSpeaker = false;
@@ -102,7 +102,6 @@ namespace MafiaTelegramBot.Game.GameRooms
                     Keyboard.VoteKeyboard(alivePlayers, Player.Id, !Player.IsFirst));
                 voteTimer.Elapsed += async (_, _) =>
                 {
-                    Console.WriteLine("this");
                     if (Player.IsFirst) await Room.PutUpVote(Player.Id, Player.Id, message.MessageId);
                     else await Room.PutUpVote(Player.Id, 0, message.MessageId);
                     VoteActionComplete.Set();

+ 1 - 1
MafiaTelegramBot/Models/Commands/Command.cs

@@ -50,7 +50,7 @@ namespace MafiaTelegramBot.Models.Commands
                 return await ((Command?) CustomHandlers["UsersThatCreatesRoom"].Clone(chatId, userId))!.Execute(update);
             if (Bot.UserThatEntersPrivateCode.Remove(userId))
                 return await ((Command?) CustomHandlers["UserThatEntersPrivateCode"].Clone(chatId, userId))!.Execute(update);
-            return await Bot.SendWithMarkdown2(chatId, $"{strings.command_not_found} _*\\({message}\\)*_");
+            return await Bot.SendWithMarkdown2(chatId, $"{strings.command_not_found} _*({message})*_");
         }
     }
 }

+ 1 - 1
MafiaTelegramBot/Models/Inlines/ApplyRolesChangeQuery.cs

@@ -21,7 +21,7 @@ namespace MafiaTelegramBot.Models.Inlines
             else SwitchRole(roleQuery);
             var message = $"{strings.current_enabled_roles}";
             foreach (var (role, count) in _room.CustomRoomSettings)
-                message += $"\n| {roles.ResourceManager.GetString(role.ToString())} \\({count}\\) |";
+                message += $"\n| {roles.ResourceManager.GetString(role.ToString())} ({count}) |";
             return await Bot.EditMessageAsync(ChatId, update.CallbackQuery.Message.MessageId, message, Keyboard.ChangeRolesKeyboard(UserId, roomKey, _room));
         }
 

+ 3 - 3
MafiaTelegramBot/Models/Inlines/ChangeRolesQuery.cs

@@ -20,9 +20,9 @@ namespace MafiaTelegramBot.Models.Inlines
             var message = $"{strings.current_enabled_roles}";
             foreach (var (role, count) in room.CustomRoomSettings)
             {
-                if (role is Roles.Mafia) message += $"\n| {roles.Mafia} \\({count}\\) |";
-                if (role is Roles.Villager) message += $"\n| {roles.Villager} \\({count}\\) |";
-                else message += $"\n| {roles.ResourceManager.GetString(role.ToString())} \\({count}\\) |";
+                if (role is Roles.Mafia) message += $"\n| {roles.Mafia} ({count}) |";
+                if (role is Roles.Villager) message += $"\n| {roles.Villager} ({count}) |";
+                else message += $"\n| {roles.ResourceManager.GetString(role.ToString())} ({count}) |";
             }
             return await Bot.SendWithMarkdown2(ChatId, message, Keyboard.ChangeRolesKeyboard(UserId, roomKey, room));
         }

+ 1 - 1
MafiaTelegramBot/Models/Inlines/Query.cs

@@ -36,7 +36,7 @@ namespace MafiaTelegramBot.Models.Inlines
                 var queries = Bot.Queries;
                 var command = FirstOrDefault(queries, query);
                 if(command != null) await ((Query?) command.Clone(chatId, userId))!.Execute(update);
-                else await Bot.SendWithMarkdown2(chatId, $"{strings.command_not_found} _*\\({data}\\)*_");
+                else await Bot.SendWithMarkdown2(chatId, $"{strings.command_not_found} _*({data})*_");
             }
         }
     }

+ 1 - 1
MafiaTelegramBot/Models/Replies/Reply.cs

@@ -16,7 +16,7 @@ namespace MafiaTelegramBot.Models.Replies
             await Bot.Get().SendChatActionAsync(chatId, ChatAction.Typing);
             var command = FirstOrDefault(commands, message);
             if(command != null) return await ((Reply?) command.Clone(chatId, userId))!.Execute(update);
-            return await Bot.SendWithMarkdown2(chatId, $"{strings.command_not_found} _*\\({message}\\)*_");
+            return await Bot.SendWithMarkdown2(chatId, $"{strings.command_not_found} _*({message})*_");
         }
     }
 }

+ 3 - 3
MafiaTelegramBot/Utilities.cs

@@ -37,6 +37,9 @@ namespace MafiaTelegramBot
                     .Replace("[", "\\[")
                     .Replace("]", "\\]")
                     .Replace("(", "\\(")
+                    .Replace(">", "\\>")
+                    .Replace("+", "\\+")
+                    .Replace("=", "\\=")
                     .Replace(")", "\\)")
                     .Replace("|", "\\|")
                     .Replace("!", "\\!")
@@ -55,9 +58,6 @@ namespace MafiaTelegramBot
                         .Replace("*", "\\*")
                         .Replace("~", "\\~")
                         .Replace("`", "\\`")
-                        .Replace(">", "\\>")
-                        .Replace("+", "\\+")
-                        .Replace("=", "\\=")
                         .Replace("{", "\\{")
                         .Replace("}", "\\}")
                         .Replace("@", "\\@")