Commit graph

36 commits

Author SHA1 Message Date
broccolai
d5259dfbe4 Add explict this checkstyle rule and fix violations 2021-07-05 02:56:06 -07:00
p5nbTgip0r
f83eb6c4a1 Restore old UserParser constructor and deprecate it 2021-07-05 02:56:06 -07:00
p5nbTgip0r
c0df263a32 Use GLOBAL isolation by default 2021-07-05 02:56:06 -07:00
p5nbTgip0r
80ad84f2e8 JDA: Guild isolation for user argument 2021-07-05 02:56:06 -07:00
p5nbTgip0r
775cf803fa JDA: Add role argument parser 2021-07-05 02:56:06 -07:00
Alexander Söderberg
1600ef16c3
:clock: 2021 let's go!!! 2021-01-16 09:58:46 +01:00
p5nbTgip0r
09f8dbd956 🐛 JDA: Fix webhook messages throwing NPE (#214)
* Fix NPE with webhook messages.

Webhook messages would be constructed as `JDAGuildSender`, which calls `Objects.requireNonNull(event.getMember())` however the JDA documentation states that the `getMember()` method will `be null in case of Message being received in a PrivateChannel or isWebhookMessage() returning true.` If the message is a webhook message, a generic `JDACommandSender` instance will be constructed instead of a `JDAGuildSender`

* Add webhook fix to changelog
2021-01-16 08:54:07 +01:00
p5nbTgip0r
2723ec13f9 JDA channel argument parsing improvements.
- Ensure that the parsing modes list cannot be empty when constructing `MessageParser`
- Don't proceed if the command context does not have the message event stored
- Don't proceed if the message was not sent in a guild
- Remove `|| modes.size() == 1` check in channel mention parsing
2021-01-16 08:54:07 +01:00
p5nbTgip0r
3a047c1ce0 Add more context keys to JDA preprocessor 2021-01-16 08:54:07 +01:00
p5nbTgip0r
a2796bee04 Fix JDA mentioned user argument parsing if a mention is not given.
If only `ParserMode.MENTION` was set as a parsing mode, the initial check for `input.endsWith(">")` would be bypassed and the input would begin to be parsed like a mention. If the input was less than three characters long then the `substring` calls would give a very ambiguous error along the lines of `begin 2, end X-1, length X`.

This commit fixes this issue by adding a check to make sure the input is an actual user mention. If the input isn't a mention then an exception will be set stating that the sender's input was not a user mention.

In addition, this commit also removes the `modes.size() == 1` check in the mention parser. I'm not sure why this was there to begin with, but I don't think that the input parsing check should be bypassed because only one parsing mode is specified. I settled on a check in the `UserParser` constructor to make sure that the parsing modes list isn't empty in order to ensure that at least one parser mode handles the input.
2021-01-16 08:54:07 +01:00
p5nbTgip0r
591f2750c5 Register ChannelArgument and UserArgument as parsers for JDA 2021-01-16 08:54:07 +01:00
jmp
b848070d57 Use an Object with fields instead of a Map for dependency versions 2021-01-16 08:54:07 +01:00
jmp
f1e467038c Rename vers to versions 2021-01-16 08:54:07 +01:00
jmp
2c188eb130 Convert build scripts to Kotlin
Also added some new tasks to only build/install to maven local certain platforms
`buildMinecraft`, `installMinecraft`, `buildDiscord`, `installDiscord`, `buildIRC`, `installIRC`
2021-01-16 08:54:07 +01:00
jmp
7df6917fe4 Added CommandExecutionException which wraps any exception thrown during the execution of command handlers. Should be handled using CommandManager#registerExceptionHandler, similar to NoSuchCommandException, ArgumentParseException, etc. 2020-12-07 20:05:45 +01:00
Alexander Söderberg
cfac2639ad Add errorprone and fix warnings/errors
The compiler will also treat all warnings as errors from now on.
2020-10-24 19:52:44 +02:00
jmp
6ffee9d04f Make changes from PR comments 2020-10-24 19:52:44 +02:00
Alexander Söderberg
da0d586e52 📚 Add missing @Since annotations 2020-10-24 19:52:44 +02:00
Alexander Söderberg
d6ccc1d59b 🧹 Clean up the gradle build scripts a little
Changes:
- Move all dependency versions to a shared file
- Order the projects in settings.gradle
2020-10-24 19:52:44 +02:00
broccolai
f3abbf5958 Fix code style issues in jda 2020-10-24 19:52:44 +02:00
broccolai
c5873e46e6 Deprecate JDACommandManager and add JDA4CommandManager 2020-10-24 19:52:44 +02:00
broccolai
530ecc4f73 Bump JDA version 2020-10-24 19:52:44 +02:00
broccolai
36afe207d7 Change JDACommandListeners sendMessage back to queue instead of complete 2020-10-24 19:52:44 +02:00
broccolai
c0bc1e7523 Fix custom senders on Cloud-JDA
Switches the command sender class to JDACommandSender and allows for it to be constructed with a nullable MessageReceivedEvent allowing for poeple to have backwards mappers
2020-10-24 19:52:44 +02:00
broccolai
433cd88c90 Change UserArgument
Changed list usages to set and made the default builders use the mention parser
2020-10-24 19:52:44 +02:00
jmp
fba29041e6 🎨 Add caption for string "No input was provided" 2020-10-24 19:52:44 +02:00
dependabot[bot]
e993d0e41c ⬆️ Bump JDA from 4.2.0_207 to 4.2.0_210
Bumps JDA from 4.2.0_207 to 4.2.0_210.

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-23 22:44:42 +02:00
Josh Taylor
8ebb248a47
JDA improvements (#39) 2020-10-09 13:29:47 +02:00
Alexander Söderberg
2aac3980d5 ♻️ Reformat + Update .editorconfig 2020-10-07 22:47:48 +02:00
Josh Taylor
f1d4529276
Cleanup annotations and remove Cloud Brigs Pair (#32) 2020-10-06 12:40:35 +02:00
JarFiles
7fee9546e5 Update Permission Mapper + added default discord permissions
The permission mapper now does what it was supposed to do and now has support for discord's default permissions
2020-10-05 22:43:47 +01:00
JarFiles
90940fafd7 Fixed Code Style issues 2020-10-05 22:43:25 +01:00
JarFiles
e5f9b3d8ca Create custom mapper for permissions
Adds the possibility to specify a custom mapper for command permissions (e.G. for permissions in private messages or if you just don't want to use discord's built-in permission system)
2020-10-05 22:43:25 +01:00
Alexander Söderberg
d6a2062069
Fix annotation order 2020-10-05 17:56:12 +02:00
JarFiles
72e578ff22
Add Javacord Support (#23)
Co-authored-by: Alexander Söderberg <Sauilitired@users.noreply.github.com>
2020-10-05 17:51:41 +02:00
broccolai
212145cc6b Add JDA implementation 2020-10-05 17:48:47 +02:00