Leslie Geddes, 39, of Spey Street in Rothes had been drinking with friends on May 24 last year when he got into an argument in the town.
He was asked to leave the Provost Christie Drive home of Douglas Wilson and did so – but later returned after a series of online exchanges. Fiscal deputy Ruairidh McAlister told the court that at around 11pm that evening Geddes punched Mr Wilson before pulling a knife and waving it at those present.
Police were called and while they began their enquiries Geddes discarded the knife and left the house.
In his defence counsel Stephen Carty told the court that alcohol was “certainly the factor”, saying that his client realised in the cold light of day that taking a knife with him was a “ridiculous thing to have done”.
Sheriff James Hendry said that it was with “some reluctance” that he would impose a community payback order rather than a prison sentence.
Geddes was ordered to undertaken 160 hours of unpaid work within six months.