Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your API is broken. #9

Open
superSebi opened this issue Jul 28, 2020 · 0 comments
Open

Your API is broken. #9

superSebi opened this issue Jul 28, 2020 · 0 comments

Comments

@superSebi
Copy link

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();
                                }
                            }
                        });
                    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant