init
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Menu
|
||||
{
|
||||
public async Task ShowMenu(AllRooms allRooms)
|
||||
{
|
||||
bool quit = false;
|
||||
while (!quit)
|
||||
{
|
||||
Console.WriteLine("Choose room to kick t2bots");
|
||||
foreach ((string internalID, Room room) in allRooms.roomList)
|
||||
{
|
||||
Console.WriteLine($"{room.name} -- {room.internalID}");
|
||||
}
|
||||
Console.WriteLine("Type/paste internal ID:");
|
||||
|
||||
string? selectedInternalID = Console.ReadLine();
|
||||
if (selectedInternalID == null)
|
||||
continue;
|
||||
selectedInternalID = selectedInternalID.Trim();
|
||||
if (selectedInternalID == "")
|
||||
continue;
|
||||
|
||||
if (allRooms.roomList.ContainsKey(selectedInternalID))
|
||||
{
|
||||
var room = allRooms.roomList[selectedInternalID];
|
||||
if (room != null)
|
||||
{
|
||||
Console.WriteLine("Enter 'd' for dry run or 'r' for real run");
|
||||
string key = Console.ReadLine();
|
||||
if (key == "d")
|
||||
{
|
||||
await room.KickT2Bots(true);
|
||||
|
||||
Console.WriteLine("Do you want to kick for real? Enter 'r' or 'y'");
|
||||
string forReal = Console.ReadLine();
|
||||
if (forReal == "r" || forReal == "y")
|
||||
{
|
||||
await room.KickT2Bots(false);
|
||||
|
||||
Console.WriteLine("Press enter to continue.");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
else if (key == "r")
|
||||
{
|
||||
await room.KickT2Bots(false);
|
||||
Console.WriteLine("Press enter to continue.");
|
||||
Console.ReadLine();
|
||||
}
|
||||
else
|
||||
Console.WriteLine("unknown input");
|
||||
Console.WriteLine("\n\n");
|
||||
}
|
||||
} else {
|
||||
Console.WriteLine("No such ID\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user