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

Added a way to set bot activity and custom status when creating bot #1259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RealYusufIsmail
Copy link
Contributor

@RealYusufIsmail RealYusufIsmail commented Aug 18, 2023

Checklist

Changelog

  • Currently only activity can be set after bot has started.

Breaking Changes

Description

Added ability to set activity as it starts.

String token = "your token";

        DiscordApi api = new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.playing("with Javacord")).login().join();

or for example
new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.custom("with Javacord")).login().join();

or for example
new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.playing("JavaCord", "in IDE")).login().join();
image image image

Closes: NaN

Footnotes

  1. At least started a running bot instance with your changes and triggered an event so your changed code gets executed.

@RealYusufIsmail
Copy link
Contributor Author

image

@RealYusufIsmail RealYusufIsmail marked this pull request as ready for review August 18, 2023 20:14
@RealYusufIsmail
Copy link
Contributor Author

image
public class Test {
    public static void main(String[] args) {
        String token = "";

        new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.custom("with Javacord")).login().join();
    }
}

@RealYusufIsmail
Copy link
Contributor Author

image
public class Test {
    public static void main(String[] args) {
        String token = "";

        new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.playing("JavaCord", "in IDE")).login().join();
    }
}

@RealYusufIsmail RealYusufIsmail changed the title Adding way to set bot activity when creating bot Added a way to set bot activity when creating bot Aug 19, 2023
@RealYusufIsmail RealYusufIsmail changed the title Added a way to set bot activity when creating bot Added a way to set bot activity and custom status when creating bot Feb 19, 2024
@@ -939,6 +966,7 @@ public void updateStatus() {
return Optional.of(type);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this check above be removed? Else you can only set the custom status at startup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented the new changes but I need to test it

DiscordApi api = new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.playing("with Javacord")).login().join();

or for example
new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.custom("with Javacord")).login().join();

or for example
new DiscordApiBuilder().setToken(token)
                .setActivity(BotActivity.playing("JavaCord", "in IDE")).login().join();
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

Successfully merging this pull request may close these issues.

2 participants