Example usage for twitter4j Twitter destroyDirectMessage

List of usage examples for twitter4j Twitter destroyDirectMessage

Introduction

In this page you can find the example usage for twitter4j Twitter destroyDirectMessage.

Prototype

void destroyDirectMessage(long id) throws TwitterException;

Source Link

Document

Deletes the direct message specified in the required ID parameter.

Usage

From source file:com.ikungolf.java.javatwitter.directmessage.DestroyDirectMessage.java

License:Apache License

/**
 * Usage: java twitter4j.examples.directmessages.DestroyDirectMessage [message id]
 *
 * @param args message/*from   ww w .j a  va2s .  co  m*/
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.directmessages.DestroyDirectMessage [message id]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.destroyDirectMessage(Long.parseLong(args[0]));
        System.out.println("Successfully deleted message [" + args[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to delete message: " + te.getMessage());
        System.exit(-1);
    }
}