I want to be a robot that pushes messages regularly every day, but my current robot needs to send commands. How to write a robot that can push messages automatically without sending commands?
@Bean
@ConfigurationProperties(value = "discord")
public DiscordApi discordApi() {
DiscordApi api = new DiscordApiBuilder().setToken("my token")
.setAllNonPrivilegedIntents()
.login()
.join();
api.addMessageCreateListener(event ->{
if(event.getMessageContent().equals("Ping")){
event.getChannel().sendMessage("Pong");
}
});
return api;
}