Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean executePost(String channel, String sender, String message) {
- String[] messageArray = message.split(" ");
- if (messageArray[0].equals("!hypeBot")) {
- HypeBot bot = HypeBotMain.getHypeBot();
- if (messageArray[1].equals("kill")) {
- if (checkSender(sender)) {
- kill(channel, sender);
- } else {
- bot.sendMessage(channel, "You don't have permission to do that, " + sender + "!");
- }
- } else if (messageArray[1].equals("hello")) {
- bot.sendMessage(channel, "Hello " + sender);
- } else if (messageArray[1].equals("edit")) {
- String fullname = messageArray[2];
- String commentOrSelf = messageArray[3];
- String text = messageArray[4];
- String subreddit = messageArray[5];
- SubmitActions redditUserSubmitActions = HypeBotMain.getRedditUserSubmitActions();
- if (commentOrSelf.equals("self")) {
- redditUserSubmitActions.editSelfPost(fullname, text, subreddit);
- } else {
- redditUserSubmitActions.editComment(fullname, text, subreddit);
- }
- } else if (messageArray[1].equals("hype")) {
- bot.sendMessage(channel, "HYPE!");
- } else if (messageArray[1].equals("getpost")) {
- SubmitActions redditUserSubmitActions = HypeBotMain.getRedditUserSubmitActions();
- String type = messageArray[2];
- String id = messageArray[3];
- Response result = null;
- if (type.equals("self")) {
- result = redditUserSubmitActions.getInfoSelfPost(id, "castawaymattbrush");
- } else if (type.equals("comment")) {
- result = redditUserSubmitActions.getInfoComment(id, "castawaymattbrush");
- }
- bot.sendMessage(channel, result.toString());
- JSONObject resultAsJSON = (JSONObject) result.getResponseObject();
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- bot.sendMessage(channel, "casted is: " + resultAsJSON.toString());
- //List<String> resultList = new ArrayList<String>();
- String resultBody = (String) resultAsJSON.get("body");
- bot.sendMessage(channel, resultBody);
- }
- return true;
- }
- return false;
- }
Add Comment
Please, Sign In to add comment