Speaker of the House Paul Ryan took jabs at both Republicans and Democrats Thursday night at the annual Alfred E. Smith Memorial Foundation dinner in New York City — but some of his pointed barbs took aim at President Trump.

“I know last year at this dinner Donald Trump offended some people with his comments which critics said went too far,” Ryan joked. “Some said it was unbecoming of a public figure and that his comments were offensive… Well, thank God he’s learned his lesson.”

The event, which raises money for Catholic charities, brings in some of the nation's biggest political heavyweights each year. Last year, then-candidates Trump and Hillary Clinton took swipes at each other, to some controversy. The dinner encourages speakers to "poke fun at political issue, an opponent or themselves," according to its program.

Ryan also poked fun at Gov. Chris Christie, R-N.J. The speaker explained that he loved October, calling it his “favorite time of the year.” Then he joked: “Deer season is on, the leaves are changing, the beaches are empty. Or as Chris Christie calls them, perfect.”

Turning his address towards Democratic leadership, Ryan said, “A lot of people ask me what it’s like to work on a daily basis with an abrasive New Yorker with a loud mouth… But once you get to know him, Chuck’s [Schumer] not all that bad.”

“I know why Chuck has been so hard on President Trump. It’s not ideological, Chuck is just mad he lost his top donor,” Ryan said of Trump, who in past years donated to the Democratic Party.

Next taking aim at Hillary Clinton, he told the audience that he bought her new book, “What Happened.”

“This sums up today’s politics perfectly,” Ryan said. “She took 8 months, writing 10 hours a day, to explain what happened in 512 pages. The president explained it in a tweet. Hashtag, I won.”

He later mocked former White House chief strategist Steve Bannon, who had a prominent and influential role within the Trump administration. Ryan said that since Bannon resigned from office, he’s “now second in line of succession.”

The speaker then quipped that Bannon said Ryan was “born in a petri dish at the Heritage Foundation. This is amazing – no one knew Steve believed in science.”

Before he finished on a more serious note, mentioning the recent hurricanes, wildfires and the massacre in Las Vegas, Ryan also said he was learning “that becoming Speaker of the House is a stepping stone… to becoming ex-Speaker of the House.”

At last year's dinner, Trump was jeered when he quipped that Clinton was "so corrupt she got kicked off the Watergate Commission."

Clinton shot back, saying she understood Trump was leery of teleprompters because they can be difficult to follow, and "I'm sure it's even harder when you're translating from the original Russian."

But an outburst came from the audience when Trump brought up Clinton's emails, which were leaked by Wikileaks. He claimed she was "pretending not to hate Catholics," in an apparent reference to 2011 emails from a Clinton campaign spokeswoman that mocked Catholics and evangelical Christians.

The Associated Press contributed to this report.