java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

Your API is broken.

Open superSebi opened this issue 4 years ago • 0 comments

Expected Behavior That your api is working.

Observed Behavior Instead your API is returning this:

org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:507)
at org.json.JSONObject.(JSONObject.java:222)
at org.json.JSONObject.(JSONObject.java:406)
at org.discordbots.api.client.impl.DiscordBotListAPII

Code:

public void onReady(@NotNull ReadyEvent event) {

    DiscordBotListAPI api = new DiscordBotListAPI.Builder()
            .token("Here stands the token 👍 ")
            .botId("493066387183632387")
            .build();
    new Timer().schedule(new TimerTask() {

        @Override
        public void run() {
            //event.getJDA().getPresence().setGame(null);
            new Thread(() -> {
                    for (Member m : Objects.requireNonNull(Main.shardMan.getGuildById("504609411243704365")).getMembers()) {
                        api.hasVoted(m.getId()).whenComplete((hasVoted, e) -> {
                            if (hasVoted) {
                                if (!m.getRoles().contains(Objects.requireNonNull(Main.shardMan.getGuildById("504609411243704365")).getRoleById("610402330315325472"))) {
                                    String votes = "Herbert cant load any data";

                                    Objects.requireNonNull(Objects.requireNonNull(Main.shardMan.getGuildById("504609411243704365")).getTextChannelById("504609411243704365")).sendMessage(new EmbedBuilder()
                                            .setColor(Color.cyan)
                                            .setDescription(m.getAsMention() + " voted the **" + votes + "th** for me :heart:")
                        
             .build()).queue();
                                }
                            }
                        });
                    }

superSebi avatar Jul 28 '20 10:07 superSebi