Exemplo n.º 1
0
    async Task ChangeRoom(int room_id)
    {
        roomNumber = room_id;
        roomHandler.ChangeRoom(socket, user_id, room_id);

        var dataToSendChangeRoom = new DataToSendChangeRoom();

        dataToSendChangeRoom.type      = "changeroom";
        dataToSendChangeRoom.roomName  = DBHandler.GetRoomName(room_id);
        dataToSendChangeRoom.roomColor = DBHandler.GetRoomColor(room_id);
        await roomHandler.SendDataToSocket(dataToSendChangeRoom, socket);

        await PopulateRoomWithMessages();

        var dataToSendBot = new DataToSendBot();

        dataToSendBot.type    = "bot";
        dataToSendBot.message = DBHandler.GetUsername(user_id) + " connected!";
        await roomHandler.SendDataToRoom(dataToSendBot, roomNumber);
    }