When you apply Nephalia Academyâ€™s effect, the card was still discarded. Abilities that trigger when a card is discarded will still trigger.
In a Magic game, cards are discarded only from a playerâ€™s hand. Effects that put cards from a playerâ€™s library into that playerâ€™s graveyard do not cause those cards to be discarded.
If you discard a card with madness, youâ€™ll choose whether to exile it or put it on top of your library. If you put it on top of your library, you canâ€™t cast it using madness.
If a spell or ability an opponent controls causes you to make a choice and you choose to discard a card, Nephalia Academyâ€™s ability will apply.