Java tutorial
/* * Copyright (C) 2016 ChemicalDevelopment * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package stempunksbot; import java.util.Arrays; import java.util.logging.Level; import java.util.logging.Logger; import twitter4j.StallWarning; import twitter4j.Status; import twitter4j.StatusDeletionNotice; import twitter4j.StatusListener; import twitter4j.TwitterException; /** * Listens! Waiting beneath the sea... * @author director */ public class MentionListener implements StatusListener { //when a user tells mentions us @Override public void onStatus(Status status) { System.out.println(status.getUser().getScreenName() + ": " + status.getText()); /*try { //STEMpunksBot.tweet("@" + status.getUser().getScreenName() + " hey - rofl"); } catch (TwitterException ex) { Logger.getLogger(MentionListener.class.getName()).log(Level.SEVERE, null, ex); }*/ } @Override public void onDeletionNotice(StatusDeletionNotice sdn) { System.out.println(sdn.getUserId() + "'s status deleted!"); } @Override public void onTrackLimitationNotice(int i) { } @Override public void onScrubGeo(long l, long l1) { } @Override public void onStallWarning(StallWarning sw) { System.out.println("Stall warning encountered!"); } @Override public void onException(Exception excptn) { System.out.println(Arrays.toString(excptn.getStackTrace())); } }