Giter Site home page Giter Site logo

jda-applications / jda-utilities Goto Github PK

View Code? Open in Web Editor NEW
214.0 20.0 110.0 1.08 MB

A series of tools and utilities for JDA to assist in bot creation

License: Apache License 2.0

Java 100.00%
discord-bot jda bot jda-utilities bot-creation gradle

jda-utilities's Introduction

version license issues

JDA-Utilities

JDA-Utilities is a series of tools and utilities for use with JDA to assist in bot creation.

Packages

Since JDA-Utilities 2.x, the library has been split into multiple modular projects, in order to better organize it's contents based on what developers might want to use and not use.

Visit individual modules to read more about their contents!

Getting Started

You will need to add this project as a dependency (either from the latest .jar from the releases page, or via maven or gradle), as well as JDA.

With maven:

  <dependency>
    <groupId>com.jagrosh</groupId>
    <artifactId>jda-utilities</artifactId>
    <version>JDA-UTILITIES-VERSION</version>
    <scope>compile</scope>
    <type>pom</type>
  </dependency>
  <dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>JDA-VERSION</version>
  </dependency>
  <repository>
    <id>central</id>
    <name>bintray</name>
    <url>http://jcenter.bintray.com</url>
  </repository>

With gradle:

dependencies {
    compile 'com.jagrosh:jda-utilities:JDA-UTILITIES-VERSION'
    compile 'net.dv8tion:JDA:JDA-VERSION'
}

repositories {
    jcenter()
}

Individual modules can be downloaded using the same structure shown above, with the addition of the module's name as a suffix to the dependency:

With maven:

  <dependency>
    <groupId>com.jagrosh</groupId>
    <!-- Notice that the dependency notation ends with "-command" -->
    <artifactId>jda-utilities-command</artifactId>
    <version>JDA-UTILITIES-VERSION</version>
    <scope>compile</scope>
  </dependency>

With gradle:

dependencies {
    // Notice that the dependency notation ends with "-command"
    compile 'com.jagrosh:jda-utilities-command:JDA-UTILITIES-VERSION'
}

Examples

Check out the ExampleBot for a simple bot example.

Other guides and information can be found on the wiki.

Projects

Vortex - Vortex is an easy-to-use moderation bot that utilizes the JDA-Utilities library for the Command Client and some of the menus
JMusicBot - This music bot uses the Command Client for its base, and several menus, including the OrderedMenu for search results and the Paginator for the current queue
GiveawayBot - GiveawayBot is a basic bot for hosting quick giveaways!

jda-utilities's People

Contributors

almighty-alpaca avatar andre601 avatar badstagram avatar duncte123 avatar jagrosh avatar johnnyjayjay avatar kantenkugel avatar minndevelopment avatar shengaero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jda-utilities's Issues

OwnerCommand does not works as intended

Okay so... My eval command is ownerOnly (by obvious reasons) so I added my alt as a CoOwner, but when I try to run the command I cant. The snowflake is correct (I checked it with the bot and the Discord right click > copy id. Tomorrow I'll add screenshots and some code since right now there is 02:41 am.

PST: Sorry for any word mispelled, 2:42 am, a tablet and 5% of battery left.

FinderUtil improvement

While going through the FinderUtil code to find out what exactly it does, I found a lot of code of the form

if(matcher.matches()) {
  String groupX = matcher.replaceAll("$X");
  ...

which is essentially equivalent to just getting the captured group via matcher.group(X).

I'm not exactly sure if changing it would result in much more performance tho (replaceAll docs mention a reset process)

Example reference code

Bot doesn't react to clicks on reactions

I currently use the Slideshow and Slideshow builder for my bot.
When I run a command, does the bot generate the slideshow and add reactions.
But the bot doesn't notice the adding of reactions.

Some info:
I've set the EventWaiter in the Main.java as a new EventWaiter and get it later in the CmdNeko.java
I then load 30 images through a function in the HttpUtil.java.
Then finally creating the slideshow in the CmdNeko.java.

Like mentioned before does the bot create the embed and adds the images (Shows the text "Image 1/30") but it just doesn't react, when you click on the reactions.
The bot has permission to manage messages and adding embeds and it also disables the slideshow after the timeout (changes the image).

Another Issue I also had was, that adding jda-utilities to the pom.xml as artifactId causes errors (bintray doesn't have this artifactId), while adding the different libraries (jda-utilities-menu and jda-utilities-common) works completely fine.

It would be so happy, if someone could help me with that issue.

[Bug] ConcurrentModificationException with EventWaiter

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

I am opening this issue after closing #57 as it will require a proper fix and not a simple 2 line patch.

As was previously stated in that PR, EventWaiter is currently not thread safe.

java.util.ConcurrentModificationException: null
    at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
    at java.util.HashMap$KeyIterator.next(HashMap.java:1466)
    at java.util.AbstractCollection.toArray(AbstractCollection.java:196)
    at com.jagrosh.jdautilities.commons.waiter.EventWaiter.onEvent(EventWaiter.java:239)

Add support to customize footer text in Paginator

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

I would like it, if a method could be added to customize/alter the footer, including to set an avatar, the text displayed (Maybe add the "Page n/n" after the provided one?) and a timestamp.

That way could the paginator stick to the design that the bot may use through different commands. (e.g. showing a Requested by: <user> text in the footer)

Cannot get all members of the guild

Can you check this code?
This was working before.
Essentially it does not get all the members, only me and my bot... and I am always the lucky one.

I am on utilities version 3.0.4 and JDA version 4.2.0_198

`
class RandomMember : Command() {
init {
name = "random"
help = "I will print a random member of the sever, excluding the bots."
cooldown = 1
}

override fun execute(event:CommandEvent) {
handleChannelException(event) {
event.reply(
"And the lucky one is... ${event.guild.members.filterNot {
it.user.isBot
}.random().effectiveName
}"
)
event.message.addReaction("โœ…").queue()
}
}
}
`

IllegalStateException: This message event did not happen in a text channel

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the [issue tracker][issues].
  • I have updated to the [latest version][download] of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

  • For examples, check out the [examples module][examples-module] or the list
    of [JDA-Utilities projects][jda-u-projects].
  • For questions join the [official JDA discord server][guild] and ask them
    in our #jda-utilities channel.
  • For general programming questions, visit [StackOverflow][stack overflow].

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the [JDA issue tracker][jda-issues]
and open an issue there.

Description

When I use the ButtonBuilder in a private message and the user react to answer it the buttonMenu use the function event.getGuild (ButtonMenu.java:135). This function call is try getting the guild from a TextChannel (GenericMessageEvent.java:126) and not from a private channel. This ends in a IllegalStateException: This message event did not happen in a text channel

[Feature] Better support for command arguments

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
  • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Commands often make use of arguments, sometimes even multiple. Currently the Commands module doesn't support arguments beyond providing a maybe null args.

What I would like is support for the following features:

  • Providing args as a list of strings, which would be the current args but split by spaces
  • An optional minimum and maximum amount of required arguments for commands that require them (for example, a command could require one or two arguments, replying with feedback when not enough or too many arguments are provided)
  • Support for flags, enabling things like -c for compact output for mobile users

I took inspiration from command line frameworks like oclif's https://oclif.io/docs/args and https://oclif.io/docs/flags.

[Feature] Make CommandEvent cancellable

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Recently I've been wondering why the CommandEvent is not cancellable. This could have a number of use-cases, primarily in the CommandListener#onCommand method, where a developer could do pre-command checks, and cancel the command execution if needed.

I mainly opened this issue to ask for some advice first, because in my mind this should be a reasonably simple modification to JDA-Utilities that I should be able to contribute, but if there are any problems or difficulties that I have overlooked, please tell me so.

Default Game Always Used

Regardless of using CommandClientBuilder#useDefaultGame, the default is always used. To mitigate this, the default value for Game on line 38 of CommandClientBuilder should be null since null is already checked for in CommandClientImpl#onReady.

EventWaiter doesn't handle consistently GuildMemberJoinEvent

Hi I am using the event waiter like this:

waiter.waitForEvent(GuildMemberJoinEvent::class.java, {true}) {
        rootLogger.info(it.member.effectiveName)

        val welcomeMessage = "Welcome!"
        it.member.guild.getTextChannelById(config.getLong("config.inviteChannelId"))!!.sendMessage(welcomeMessage).queue()
}

But sometimes the message does not appear in the channel, I suspect the EventWaiter is buggy and it doesn't trigger. Any idea?

Doesn't work at all.

I create a base bot, it doesn't work at all

My main class:

package jtools;

import com.jagrosh.jdautilities.command.CommandClient;
import com.jagrosh.jdautilities.command.CommandClientBuilder;
import com.jagrosh.jdautilities.commons.waiter.EventWaiter;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.AccountType;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity;
import jtools.different.PingCommand;

public class BaseBot {

    public static void main(String[] args) throws Exception {
        EventWaiter waiter = new EventWaiter();
        CommandClientBuilder builder = new CommandClientBuilder();
        builder.setPrefix("j!")
                .setOwnerId("660110922865704980")
                .setHelpWord("help")
                .addCommand(new PingCommand());

        CommandClient client = builder.build();

        new JDABuilder(AccountType.BOT)
                .setToken("")
                .setActivity(Activity.playing("j!help"))
                .setStatus(OnlineStatus.IDLE)
                .addEventListeners(waiter, client)
                .build();
    }
}

PingCommand class:

package jtools.different;

import com.jagrosh.jdautilities.command.Command;
import com.jagrosh.jdautilities.command.CommandEvent;

public class PingCommand extends Command {
    public PingCommand(){
        this.name = "ping";
    }

    @Override
    protected void execute(CommandEvent commandEvent) {
        commandEvent.reply("Hello, my ping is " + commandEvent.getJDA().getGatewayPing());
    }
}

Please help me

(Solved) NoSuchMethodError on getHttpClientBuilder()

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Describe your issue here.

I seem to be getting a NoSuchMethodError for "net.dv8tion.jda.core.entities.impl.JDAImpl.getHttpClientBuilder()Lokhttp3/OkHttpClient$Builder;" when I start my bot up.
Please provide any stack-traces, code, or pictures that will help describe the issue you are encountering.
https://pastebin.com/3WQhUu0r

[Sugestion] Translation

There is some files to change the translation?
Something like !help command: "For additional help, contact Zap#2504"

Error with AboutCommand

Whenever I use ::about, I get the following error, in Pastebin form. http://pastebin.com/H6SMmHGU

new AboutCommand(Color.green.brighter(), "a (currently) small utility bot that is actively being developed. [GitHub](https://github.com/raxixor/EDI)", new String[] {"Easy to modify", "Requires knowledge of java to host yourself", "Actively developed"}),

help command doesn't show any commands

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Describe your issue here.

Please provide any stack-traces, code, or pictures that will help describe the issue you are encountering.

I have added some command and tried help command, but instead of showing list of commands, it showed like this
image
Here's my codes
image
image

[Bug] Latest version JAR still uses net.dv8tion.jda.core instead of net.dv8tion.jda.api.

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

JAR downloads of JDA-Utilities still uses net.dv8tion.jda.core instead of net.dv8tion.jda.api. In which causes java.lang.ClassNotFoundException being thrown.

Code in eclipse with stack trace
JDA-Utilities code of CommandClientBuilder with the wrong reference package used

(To be edited) Image of net.dv8tion.jda.api.OnlineStatus

[Feature] .removeMessages(int count)

So, i'm not exactly sure if this is possible, I haven't found a way to do it. If it is possible.. im sorry im a noob... but anyways,

basically on any "TextChannel" object, theres a void method called .removeMessages(int count) that gets the amount of messages specified in the channel, and deletes them. This would be good for something like a purge command. If this already exists, this could be a way to make it easier..

Anyways, just a suggestion.
Thanks for reading!

requiredRole

Suggestion

Add a way to set multiple requiredRole when creating a command.

Suggestion: Allow paginated menu to skip to the end/start

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

I want to suggest a change to the PaginatorBuilder, to allow skipping to the end or start of the pages.
By that I mean the following cases:

  • When you're on page one of x and click on โ—€๏ธ you land on page x.
  • When you're on page x and click on โ–ถ๏ธ you'll land on page 1.

Unicode emotji doesn't work with JDA 3.0.0_191

If unicode emoji passed in CommandClientBuilder#setEmojis it will cause NumberFormatException, becouse when reacting CommandEvent tries to use JDA#getEmoteById, which throw NFE when givem string can't be parsed. Check in CommandEvent is for null return, and try/catch only for PermissionException so NFE catched in JDA only.

Playlist

Your new release says you added an option to play the playlist but how do we do that ??

[Feature] Language Localization

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Currently JDA-Utilities is available only in English with no support for other languages.

A similar suggestion was made in #33, where I referenced that we were playing around with the idea of multi-language support for the library.

Additionally to this feature, an addition to GuildSettingsProvider should be made to support per-guild languages.

Finally, this will most likely support several default languages, and translations from JDA community members are more than appreciated.

Embed pagination in the menu module

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
  • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

I would like to request paginating embeds in to the JDA-Utilities Menu module. This has been done in various bots such as R. Danny. It would be a more readable alternative with ability to style the embeds inside.

Add support to directly add MessageEmbeds to Paginator

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

The paginator, while nice to use, is limited in how much you can customize it.
In fact, other than changing, if the page number should be shown in the footer, the color and the actual description itself is the Paginator not that customizable, considering it using embeds.

My suggestion is to implement support, to directly provide MessageEmbed(s) through a addItems(MessageEmbed...) method.

Why do I not implement it?
The current code of the Paginator is way too strict and complicated, as that it would allow to directly add MessageEmbeds without an entire recode (Unless you guys know a proper way).
I wanted to implement it myself, but it's just way too much and would result on an entire recode on my end, which is not what I want to achieve here, as this would also be a difficult part in a PR.

Add ability to clear items in Slideshow.Builder

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Describe your issue here.

Please provide any stack-traces, code, or pictures that will help describe the issue you are encountering.

The Paginator.Builder Class has the option to clear existing items with the function clearItems().
The Slideshow.Builder Class, while almost identical, is missing this function.
This causes previous images to still be in the pages, even after opening a new instance of the Slideshow.

Button Menu Issue

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

When I set an action for a Button Menu it never gets run. I create i menu that is sent to a players Direct Message to confirm an action to be ran back on the server.

Code:
https://pastebin.com/akELa7y4

FinderUtil issue

(Yes, me again) Using FinderUtils I noticed when someone has a Nickname on a Guild if you try to get a user just doing for example /user artuto, the list will be empty, unless the user doesnt has a nickname, but you can do /user artuto's nickname.

Could this be an issue or is intended?

GuildSettingsManager and GuildSettingsProvider implementation

The JavaDoc for GuildSettingsManager and GuildSettingsProvider tells what they do but not how they should be implemented.

It would be nice to have a simple implementation code in the class-level JavaDoc so we can have a guideline on how to use it.

CommandClientBuilder: UnirestException - ClassDefNotFoundException

Can't build the client (client.build()).

Exception in thread "main" java.lang.NoClassDefFoundError: com/mashape/unirest/http/exceptions/UnirestException
	at com.jagrosh.jdautilities.commandclient.CommandClientBuilder.build(CommandClientBuilder.java:63)
Caused by: java.lang.ClassNotFoundException: com.mashape.unirest.http.exceptions.UnirestException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 2 more

getTextualPrefix() is null after re-initializing Client

So basically here's my setup

When the bot is first started this is what I do.

private static CommandClient client;

CommandClientBuilder clientBuilder = CommandHandler.init();
client = clientBuilder.build();

jda = new JDABuilder(AccountType.BOT)
             .setToken(getSettingsManager().getToken())
             .setStatus(OnlineStatus.DO_NOT_DISTURB)
             .addEventListener(eventWaiter)
             .addEventListener(client)
             .buildAsync();
public static CommandClientBuilder init() 
{
        CommandClientBuilder client = new CommandClientBuilder();
        client.setOwnerId("<redacted>");
        client.setEmojis("\uD83D\uDE03", "\uD83D\uDE2E", "\uD83D\uDE26");
        client.setPrefix(LoMTools.getSettingsManager().getCommandPrefix());
        client.useHelpBuilder(false);
        client.addCommands(
                new InfoCommand(),
                new SetPrefixCommand()
        );
        return client;
}

However I have a command that changes the command prefix, which I do by re-initializing the command client

    public static JDA getJDA()
    {
        return jda;
    }

    public static void reloadClient() {
        getJDA().removeEventListener(client);
        client = null;
        CommandClientBuilder builder = CommandHandler.init();
        client = builder.build();
        getJDA().addEventListener(client);
    }

I run the command -setprefix !

However when I go into a Command Event

public class InfoCommand extends Command {
    @Override
    protected void execute(CommandEvent event) {
        EmbedBuilder builder = new EmbedBuilder();
        builder.setColor(Color.MAGENTA);
        builder.setAuthor("Information about: " + event.getSelfUser().getName() + "!", null, event.getSelfUser().getAvatarUrl());
        String descr = "Hello! I am **" + event.getSelfUser().getName() + "**, " + this.description + "\n\n" +
                "Type `" + event.getClient().getPrefix() + "help` for help!\n" +
                "Type `" + event.getClient().getTextualPrefix() + "commands` for the list of commands!\n\n";
        builder.setDescription(descr);
        builder.setFooter("I was written by " + event.getJDA().getUserById(event.getClient().getOwnerId()).getName(), event.getJDA().getUserById(event.getClient().getOwnerId()).getAvatarUrl());
        builder.setTimestamp(event.getClient().getStartTime());
        event.reply(builder.build());
    }

}

It results in getPrefix() being '!' and getTextualPrefix() being 'null'

Here is picture proof:
y6ixmed

Mistake in README.md

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • [x ] I have checked for similar issues on the issue tracker.
  • [x ] I have updated to the latest version of JDA-Utilities.
  • [x ] I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Describe your issue here.

Please provide any stack-traces, code, or pictures that will help describe the issue you are encountering.

I don't know if it can be considered as a bug report. Its a mistake in the README.md file it says JDA-UTILITIES-VERSION while it should be VERSION on its own. https://github.com/JDA-Applications/JDA-Utilities#getting-started

[Suggestion] Custom Guild Prefixes

So... My users recently asked for a way to change the default bot's prefix per guild, and since commands are managed by JDA-Utils it should have a way of setting a custom guild prefix.

Followed the example. Doesn't work at all.

Hello. My command does't work at all. I followed the example that u have provided in the wiki. It doesn't work. I have already register the CommandClient before the ready event start. It will be good if u can tell me where the mistakes are I've made.
Here is the code.
My main class:

package core;

import com.jagrosh.jdautilities.commandclient.CommandClient;
import com.jagrosh.jdautilities.commandclient.CommandClientBuilder;
import commands.FirstCmd;
import listeners.readyListener;
import listeners.voiceListener;
import net.dv8tion.jda.core.AccountType;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.JDABuilder;
import net.dv8tion.jda.core.OnlineStatus;
import net.dv8tion.jda.core.entities.Game;
import net.dv8tion.jda.core.exceptions.RateLimitedException;
import util.secrets;
import javax.security.auth.login.LoginException;

public class Main {

    public static JDABuilder b;

    public static void main(String args[]) {

        //commandBuilder
        CommandClientBuilder cb = new CommandClientBuilder();
        cb.setOwnerId(I will have to block this.);
        cb.setPrefix("w!");
        cb.setGame(Game.playing("help"));
        cb.addCommand(new FirstCmd());

        //commandClient
        CommandClient cc = cb.build();

        b = new JDABuilder(AccountType.BOT);
        b.addEventListener(cc);
        b.addEventListener(new voiceListener());
        b.addEventListener(new readyListener());

        b.setToken(secrets.TOKEN);
        b.setAutoReconnect(true);
        b.setStatus(OnlineStatus.DO_NOT_DISTURB);

        try {
            JDA jda = b.buildBlocking();
        } catch (LoginException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (RateLimitedException e) {
            e.printStackTrace();
        }
    }
}

My Command class:

package commands;

import com.jagrosh.jdautilities.commandclient.Command;
import com.jagrosh.jdautilities.commandclient.CommandEvent;

public class FirstCmd extends Command{

    public void FirstCmd() {
        this.name = "firstCmd";
        this.aliases = new String[]{"demo", "test"};
        this.help = "example command";
   } 

    @Override
    protected void execute(CommandEvent event) {
        event.reply("this is a reply");
    }
}

If its not enough, i can provide more code to u.

Incorrect version number printed from JDAUtilitiesInfo.VERSION

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
    • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Describe your issue here.

Please provide any stack-traces, code, or pictures that will help describe the issue you are encountering.

Simply outputting JDAUtilitiesInfo.VERSION still returns 2.1.1 despite using version 2.1.4

[Suggestion] ownerCommand

When setting on a command this.ownerCommand = true send an error message if a non-owner user tries to execute the command.

Option to change to the default message responses

Could the option to be able to change the default message responses for things like the user not having permission, the command being on cooldown etc be added?

It would be nice to be able to change the formatting of it to make it match my bots more.

When using Emotes ButtonMenu does not respond to reactions

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the [issue tracker][issues].
  • I have updated to the [latest version][download] of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

  • For examples, check out the [examples module][examples-module] or the list
    of [JDA-Utilities projects][jda-u-projects].
  • For questions join the [official JDA discord server][guild] and ask them
    in our #jda-utilities channel.
  • For general programming questions, visit [StackOverflow][stack overflow].

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
  • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the [JDA issue tracker][jda-issues]
and open an issue there.

Description

Describe your issue here.

Please provide any stack-traces, code, or pictures that will help describe the issue you are encountering.

When creating a ButtonMenu using Emotes, the event consumer in setAction is never called.

private void showPlatformSelectionMenu(Call call, Message welcomeMessage)
    {
        jda.retrieveUserById(call.getCallerId())
                .queue(user -> {

                    var menu = new ButtonMenu.Builder()
                            .setDescription("Please select your platform!")
                            .setUsers(user)
                            .setEventWaiter(waiter)
                            .setAction(reaction -> {
                                log.info("REACHED MENU REACTION EVENT");
                                onPlatformSelected(call, reaction);
                            })
                            .setTimeout(10, TimeUnit.MINUTES);

                    PLATFORMS.keySet().forEach(p -> menu.addChoices("a:" + p));
                    menu.build().display(welcomeMessage);
                    },
                        err -> onFailure(call, "An error occurred during platform selection.", true));
    }

FinderUtils possible addition

Could Spectra's findBannnedUsers be added to this version on FinderUtils? Would be a lot useful to me.

And yeah, i can wait until is out.

[Enhancement] Execute commands in a new thread

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
  • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Currently every command is executed sequentially. In practice this means that sometimes a user will have to wait for a command to finish running which isn't clear to that user. While running heavy code asynchronously within the execute function is a solution for this, a much better solution would be to simply run every command asynchronously.

Button Menu cannot react using emotes

Issue

Issue Checklist

Please follow the following steps before opening this issue.

Issues that do not complete the checklist may be closed without any help.

  • I have checked for similar issues on the issue tracker.
  • I have updated to the latest version of JDA-Utilities.
  • I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

The issue tracker is reserved for issues, errors, and feature requests related
to JDA-Utilities, and not questions and other requests for help.

Issue Information

Check all that apply:

  • This is a bug report about an error, issue, or bug in JDA-Utilities.
  • I have been able to consistently reproduce this bug.
  • This is a feature request for the JDA-Utilities library.

This issue tracker does not assist or handle issues with the JDA library.

For JDA related issues, visit the JDA issue tracker
and open an issue there.

Description

Using the Button Menu, when adding a choice you cannot use an emote if you have the EMOTE CacheFlag disabled.

The following code results in the following stack trace:

menuBuilder.addChoice("emote id here");
net.dv8tion.jda.api.exceptions.ErrorResponseException: 10014: Unknown Emoji
	at net.dv8tion.jda.api.exceptions.ErrorResponseException.create(ErrorResponseException.java:150)
	at net.dv8tion.jda.api.requests.Request.onFailure(Request.java:102)
	at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:239)
	at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:197)
[...]

You can workaround this by doing this (adding the emote name to the id):

menuBuilder.addChoice("a:"+"emote id here");

However, when the add reaction event is received and handled by the menu, it compares the emote ID with the internal menu list of choices, which has a:emote id and not just the id, therefore the menu will never proceed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.