|
@@ -3,6 +3,7 @@ using System.Linq;
|
|
|
using System.Threading.Tasks;
|
|
|
using MafiaTelegramBot.DataBase;
|
|
|
using MafiaTelegramBot.Game;
|
|
|
+using MafiaTelegramBot.Models;
|
|
|
using MafiaTelegramBot.Resources;
|
|
|
|
|
|
namespace MafiaTelegramBot.Controllers
|
|
@@ -65,6 +66,22 @@ namespace MafiaTelegramBot.Controllers
|
|
|
return ResultCode.CodeOk;
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ public static async Task DissolveRoom(string roomKey)
|
|
|
+ {
|
|
|
+ await Task.Run(async () =>
|
|
|
+ {
|
|
|
+ if (OpenedGames.ContainsKey(roomKey))
|
|
|
+ foreach (var player in OpenedGames[roomKey].Players.Values)
|
|
|
+ {
|
|
|
+ await player.RemoveGame();
|
|
|
+ RoomEncrypter.RemoveShortName(OpenedGames[roomKey].RoomName);
|
|
|
+ if(OpenedGames[roomKey].IsPrivate) RoomEncrypter.Remove(OpenedGames[roomKey].RoomName);
|
|
|
+ OpenedGames.Remove(roomKey);
|
|
|
+ await Bot.SendWithMarkdown2(player.ChatId, strings.room_dissolved, Keyboards.MainMenu);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
public static async Task<List<GameRoom>> GetPublicRooms()
|
|
|
{
|