Search in sources :

Example 1 with ModeratorActionData

use of chatty.util.api.pubsub.ModeratorActionData in project chatty by chatty.

the class TwitchClient method testCommands.

private void testCommands(Room room, String command, String parameter) {
    String channel = room.getChannel();
    if (command.equals("addchans")) {
        String[] splitSpace = parameter.split(" ");
        String[] split2 = splitSpace[0].split(",");
        for (String chan : split2) {
        // g.printLine(chan, "test");
        }
    } else if (command.equals("settestuser")) {
        String[] split = parameter.split(" ");
        createTestUser(split[0], split[1]);
    } else if (command.equals("setemoteset")) {
        testUser.setEmoteSets(parameter);
    } else if (command.equals("setemoteset2")) {
        getSpecialUser().setEmoteSets(parameter);
    } else if (command.equals("getemoteset")) {
        g.printLine(g.emoticons.getEmoticons(Integer.parseInt(parameter)).toString());
    } else if (command.equals("testcolor")) {
        testUser.setColor(parameter);
    } else if (command.equals("testupdatenotification")) {
        g.setUpdateAvailable("[test]");
    } else if (command.equals("testannouncement")) {
        g.setAnnouncementAvailable(Boolean.parseBoolean(parameter));
    } else if (command.equals("removechan")) {
        g.removeChannel(parameter);
    } else if (command.equals("testtimer")) {
        new Thread(new TestTimer(this, new Integer(parameter))).start();
    } else // }
    if (command.equals("bantest")) {
        int duration = -1;
        String reason = "";
        if (parameter != null) {
            String[] split = parameter.split(" ", 2);
            duration = Integer.parseInt(split[0]);
            if (split.length > 1) {
                reason = split[1];
            }
        }
        g.userBanned(testUser, duration, reason, null);
    } else if (command.equals("bantest2")) {
        String[] split = parameter.split(" ", 3);
        int duration = -1;
        if (split.length > 1) {
            duration = Integer.parseInt(split[1]);
        }
        String reason = "";
        if (split.length > 2) {
            reason = split[2];
        }
        g.userBanned(c.getUser(channel, split[0]), duration, reason, null);
    } else if (command.equals("userjoined")) {
        c.userJoined("#test", parameter);
    } else if (command.equals("echomessage")) {
        String[] parts = parameter.split(" ");
    // g.printMessage(parts[0], testUser, parts[1], false, null, 0);
    } else if (command.equals("loadffz")) {
        frankerFaceZ.requestEmotes(parameter, true);
    } else if (command.equals("testtw")) {
        g.showTokenWarning();
    } else if (command.equals("tsonline")) {
        testStreamInfo.set(parameter, "Game", 123, -1, StreamType.LIVE);
        g.addStreamInfo(testStreamInfo);
    } else if (command.equals("tsoffline")) {
        testStreamInfo.setOffline();
        g.addStreamInfo(testStreamInfo);
    } else if (command.equals("testspam")) {
        g.printLine("test" + spamProtection.getAllowance() + spamProtection.tryMessage());
    } else if (command.equals("spamprotectioninfo")) {
        g.printSystem("Spam Protection: " + c.getSpamProtectionInfo());
    } else if (command.equals("tsv")) {
        testStreamInfo.set("Title", "Game", Integer.parseInt(parameter), -1, StreamType.LIVE);
    } else if (command.equals("tsvs")) {
        System.out.println(testStreamInfo.getViewerStats(true));
    } else if (command.equals("tsaoff")) {
        StreamInfo info = api.getStreamInfo(g.getActiveStream(), null);
        info.setOffline();
    } else if (command.equals("tsaon")) {
        StreamInfo info = api.getStreamInfo(g.getActiveStream(), null);
        info.set("Test", "Game", 12, System.currentTimeMillis() - 1000, StreamType.LIVE);
    } else if (command.equals("tston")) {
        StreamInfo info = api.getStreamInfo("tduva", null);
        info.set("Test 2", "Game", 12, System.currentTimeMillis() - 1000, StreamType.LIVE);
    } else if (command.equals("usericonsinfo")) {
        usericonManager.debug();
    } else if (command.equals("userlisttest")) {
    // g.printMessage("test1", testUser, "short message", false, null, 0);
    // g.printMessage("test2", testUser, "short message2", false, null, 0);
    // g.printCompact("test3", "MOD", testUser);
    // g.printCompact("test3", "MOD", testUser);
    // g.printCompact("test3", "MOD", testUser);
    // g.printCompact("test3", "MOD", testUser);
    // g.printCompact("test3", "MOD", testUser);
    // g.printCompact("test3", "MOD", testUser);
    // g.printCompact("test3", "MOD", testUser);
    // g.printMessage("test3", testUser, "longer message abc hmm fwef wef wef wefwe fwe ewfwe fwef wwefwef"
    // + "fjwfjfwjefjwefjwef wfejfkwlefjwoefjwf wfjwoeifjwefiowejfef wefjoiwefj", false, null, 0);
    // g.printMessage("test3", testUser, "longer message abc hmm fwef wef wef wefwe fwe ewfwe fwef wwefwef"
    // + "fjwfjfwjefjwefjwoeifjwefiowejfef wefjoiwefj", false, null, 0);
    // g.printMessage("test3", testUser, "longer wef wef wefwe fwe ewfwe fwef wwefwef"
    // + "fjwfjfwjefjwefjwef wfejfkwlefjwoefjwf wfjwoeifjwefiowejfef wefjoiwefj", false, null, 0);
    // g.printCompact("test4", "MOD", testUser);
    // g.printCompact("test5", "MOD", testUser);
    // g.printCompact("test6", "MOD", testUser);
    // g.printCompact("test7", "MOD", testUser);
    // g.printCompact("test8", "MOD", testUser);
    // g.printCompact("test9", "MOD", testUser);
    // g.printMessage("test10", testUser, "longer message abc hmm fwef wef wef wefwe fwe ewfwe fwef wwefwef"
    // + "fjwfjfwjefjwefjwef wfejfkwlefjwoefjwf wfjwoeifjwefiowejfef wefjoiwefj", false, null, 0);
    } else if (command.equals("requestfollowers")) {
        api.getFollowers(parameter);
    } else if (command.equals("simulate2")) {
        c.simulate(parameter);
    } else if (command.equals("simulate")) {
        if (parameter.equals("bits")) {
            parameter = "bits " + g.emoticons.getCheerEmotesString(null);
        } else if (parameter.equals("bitslocal")) {
            parameter = "bits " + g.emoticons.getCheerEmotesString(Helper.toStream(channel));
        } else if (parameter.startsWith("bits ")) {
            parameter = "bits " + parameter.substring("bits ".length());
        }
        String raw = RawMessageTest.simulateIRC(channel, parameter, c.getUsername());
        if (raw != null) {
            c.simulate(raw);
        }
    } else if (command.equals("lb")) {
        String[] split = parameter.split("&");
        String message = "";
        for (int i = 0; i < split.length; i++) {
            if (!message.isEmpty()) {
                message += "\r";
            }
            message += split[i];
        }
        sendMessage(channel, message);
    } else if (command.equals("c1")) {
        sendMessage(channel, (char) 1 + parameter);
    } else if (command.equals("gc")) {
        Runtime.getRuntime().gc();
        LogUtil.logMemoryUsage();
    } else if (command.equals("wsconnect")) {
        frankerFaceZ.connectWs();
    } else if (command.equals("wsdisconnect")) {
        frankerFaceZ.disconnectWs();
    } else if (command.equals("psconnect")) {
        pubsub.connect();
    } else if (command.equals("psdisconnect")) {
        pubsub.disconnect();
    } else if (command.equals("modactiontest")) {
        List<String> args = new ArrayList<>();
        args.add("tirean");
        args.add("300");
        args.add("still not using LiveSplit Autosplitter D:");
        g.printModerationAction(new ModeratorActionData("", "", "tduvatest", "timeout", args, "tduva", ""), false);
    } else if (command.equals("modactiontest2")) {
        List<String> args = new ArrayList<>();
        args.add("tduva");
        args.add("fuck and stuff like that, rather long message and whatnot Kappa b " + new Random().nextInt(100));
        g.printModerationAction(new ModeratorActionData("", "", parameter == null ? "tduvatest" : parameter, "twitchbot_rejected", args, "twitchbot", "TEST" + Math.random()), false);
    } else if (command.equals("repeat")) {
        String[] split = parameter.split(" ", 2);
        int count = Integer.parseInt(split[0]);
        for (int i = 0; i < count; i++) {
            commandInput(room, "/" + split[1]);
        }
    } else if (command.equals("modactiontest3")) {
        List<String> args = new ArrayList<>();
        args.add("tduva");
        g.printModerationAction(new ModeratorActionData("", "", "tduvatest", "approved_twitchbot_message", args, "tduvatest", "TEST" + Math.random()), false);
    } else if (command.equals("loadsoferrors")) {
        for (int i = 0; i < 10000; i++) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    Helper.unhandledException();
                }
            });
        }
    } else if (command.equals("getuserid")) {
        if (parameter == null) {
            g.printSystem("Parameter required.");
        } else {
            api.getUserIdAsap(r -> {
                String result = r.getData().toString();
                if (r.hasError()) {
                    result += " Error: " + r.getError();
                }
                g.printSystem(result);
            }, parameter.split("[ ,]"));
        }
    } else if (command.equals("getuserids2")) {
        api.getUserIDsTest2(parameter);
    } else if (command.equals("getuserids3")) {
        api.getUserIDsTest3(parameter);
    }
}
Also used : ModeratorActionData(chatty.util.api.pubsub.ModeratorActionData) StreamInfo(chatty.util.api.StreamInfo)

Aggregations

StreamInfo (chatty.util.api.StreamInfo)1 ModeratorActionData (chatty.util.api.pubsub.ModeratorActionData)1