fix(deps): update dependency net.dv8tion:jda to v5.4.0
This commit is contained in:
1 parent
0d735f3744
commit
8e4a6841cc
62 files changed
+326
-147
No files matched your search
@@ -48,6 +48,8 @@ test:
|
|||||||
reports:
|
reports:
|
||||||
junit:
|
junit:
|
||||||
- "**/target/*-reports/TEST-*.xml"
|
- "**/target/*-reports/TEST-*.xml"
|
||||||
|
codequality:
|
||||||
|
- "target/gl-code-quality-report.json"
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "main"'
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == "main"'
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||||
|
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||||
|
|
||||||
|
<module name="Checker">
|
||||||
|
<property name="severity" value="warning"/>
|
||||||
|
|
||||||
|
<!-- Allows tab characters -->
|
||||||
|
<module name="FileTabCharacter">
|
||||||
|
<property name="eachLine" value="false"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="TreeWalker">
|
||||||
|
<!-- Indentation with tabs -->
|
||||||
|
<module name="Indentation">
|
||||||
|
<property name="basicOffset" value="4"/>
|
||||||
|
<property name="tabWidth" value="4"/>
|
||||||
|
<property name="forceStrictCondition" value="false"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Common useful checks -->
|
||||||
|
<module name="EmptyBlock">
|
||||||
|
<property name="option" value="text"/>
|
||||||
|
</module>
|
||||||
|
<module name="NeedBraces"/>
|
||||||
|
<module name="AvoidStarImport"/>
|
||||||
|
<module name="UnusedImports"/>
|
||||||
|
<module name="EqualsHashCode"/>
|
||||||
|
|
||||||
|
<!-- Relaxed Javadoc rules -->
|
||||||
|
<module name="JavadocMethod">
|
||||||
|
<property name="allowMissingParamTags" value="true"/>
|
||||||
|
<property name="allowMissingReturnTag" value="true"/>
|
||||||
|
</module>
|
||||||
|
</module>
|
||||||
|
</module>
|
||||||
@@ -75,6 +75,42 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<version>3.6.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>checkstyle</id>
|
||||||
|
<phase>test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>checkstyle.xml</configLocation>
|
||||||
|
<failOnViolation>true</failOnViolation>
|
||||||
|
<linkXRef>false</linkXRef>
|
||||||
|
<outputFile>target/checkstyle-result.xml</outputFile>
|
||||||
|
<outputFormat>xml</outputFormat>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>de.chkal.maven</groupId>
|
||||||
|
<artifactId>gitlab-code-quality-plugin</artifactId>
|
||||||
|
<version>1.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
@@ -100,7 +136,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dv8tion</groupId>
|
<groupId>net.dv8tion</groupId>
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>5.3.2</version>
|
<version>5.4.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.arbjerg</groupId>
|
<groupId>dev.arbjerg</groupId>
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ package me.bobert.netneutrality.command.admin;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.AdminCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.AdminCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.db.entities.OBlacklist;
|
import me.bobert.netneutrality.db.entities.OBlacklist;
|
||||||
import me.bobert.netneutrality.db.service.BlacklistService;
|
import me.bobert.netneutrality.db.service.BlacklistService;
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ package me.bobert.netneutrality.command.admin;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.AdminCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.AdminCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.core.tasks.TaskManager;
|
import me.bobert.netneutrality.core.tasks.TaskManager;
|
||||||
import me.bobert.netneutrality.tasks.emoji.EmojiReactionRoleTask;
|
import me.bobert.netneutrality.tasks.emoji.EmojiReactionRoleTask;
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ package me.bobert.netneutrality.command.basic;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.*;
|
import me.bobert.netneutrality.core.command.CommandCategory;
|
||||||
|
import me.bobert.netneutrality.core.command.CommandContainer;
|
||||||
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
|
import me.bobert.netneutrality.core.command.CommandManager;
|
||||||
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.core.tasks.BuiltInTask;
|
import me.bobert.netneutrality.core.tasks.BuiltInTask;
|
||||||
import me.bobert.netneutrality.tasks.help.BotInfo;
|
import me.bobert.netneutrality.tasks.help.BotInfo;
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ package me.bobert.netneutrality.command.basic;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandCategory;
|
import me.bobert.netneutrality.core.command.CommandCategory;
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
|
|
||||||
public class PingCommand extends AbstractCommand {
|
public class PingCommand extends AbstractCommand {
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ package me.bobert.netneutrality.command.bot;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.AdminCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.AdminCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.db.GSettings;
|
import me.bobert.netneutrality.db.GSettings;
|
||||||
import me.bobert.netneutrality.db.service.GuildService;
|
import me.bobert.netneutrality.db.service.GuildService;
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ package me.bobert.netneutrality.command.crypto;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.LogHandler;
|
import me.bobert.netneutrality.core.LogHandler;
|
||||||
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandCategory;
|
import me.bobert.netneutrality.core.command.CommandCategory;
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.http.WebModule;
|
import me.bobert.netneutrality.http.WebModule;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ package me.bobert.netneutrality.command.git;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandCategory;
|
import me.bobert.netneutrality.core.command.CommandCategory;
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.AbstractCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.http.WebModule;
|
import me.bobert.netneutrality.http.WebModule;
|
||||||
import me.bobert.netneutrality.tasks.git.ReportIssueTask;
|
import me.bobert.netneutrality.tasks.git.ReportIssueTask;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandCategory;
|
import me.bobert.netneutrality.core.command.CommandCategory;
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MessageFunction;
|
import me.bobert.netneutrality.utils.MessageFunction;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MessageFunction;
|
import me.bobert.netneutrality.utils.MessageFunction;
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ package me.bobert.netneutrality.command.music;/*
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MessageFunction;
|
import me.bobert.netneutrality.utils.MessageFunction;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.options.CommandOption;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
|
import me.bobert.netneutrality.core.command.options.CommandOption;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ package me.bobert.netneutrality.command.music;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
import me.bobert.netneutrality.core.command.CommandOptionsBuilder;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MusicCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.music.MusicManager;
|
import me.bobert.netneutrality.music.MusicManager;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ package me.bobert.netneutrality.command.react;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MessageMenuCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MessageMenuCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.core.tasks.TaskManager;
|
import me.bobert.netneutrality.core.tasks.TaskManager;
|
||||||
import me.bobert.netneutrality.tasks.emoji.EmojiReactionRoleTask;
|
import me.bobert.netneutrality.tasks.emoji.EmojiReactionRoleTask;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ package me.bobert.netneutrality.command.react;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import me.bobert.netneutrality.core.command.impl.MessageMenuCommand;
|
|
||||||
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
import me.bobert.netneutrality.core.command.CommandExecutionResult;
|
||||||
|
import me.bobert.netneutrality.core.command.impl.MessageMenuCommand;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.core.tasks.TaskManager;
|
import me.bobert.netneutrality.core.tasks.TaskManager;
|
||||||
import me.bobert.netneutrality.tasks.emoji.EmojiReactionRoleTask;
|
import me.bobert.netneutrality.tasks.emoji.EmojiReactionRoleTask;
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import me.bobert.netneutrality.core.command.options.MessageCommandOption;
|
|||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.core.context.MessageContext;
|
import me.bobert.netneutrality.core.context.MessageContext;
|
||||||
import me.bobert.netneutrality.utils.Settings;
|
import me.bobert.netneutrality.utils.Settings;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Mentions;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|||||||
@@ -8,11 +8,8 @@ package me.bobert.netneutrality.context.tasks;
|
|||||||
import me.bobert.netneutrality.context.AsyncContext;
|
import me.bobert.netneutrality.context.AsyncContext;
|
||||||
import me.bobert.netneutrality.core.context.NoMessageContext;
|
import me.bobert.netneutrality.core.context.NoMessageContext;
|
||||||
import me.bobert.netneutrality.core.context.TaskContext;
|
import me.bobert.netneutrality.core.context.TaskContext;
|
||||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
|
||||||
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionHook;
|
|
||||||
import net.dv8tion.jda.api.interactions.components.LayoutComponent;
|
import net.dv8tion.jda.api.interactions.components.LayoutComponent;
|
||||||
import net.dv8tion.jda.api.interactions.modals.Modal;
|
|
||||||
import net.dv8tion.jda.api.utils.messages.MessageCreateData;
|
import net.dv8tion.jda.api.utils.messages.MessageCreateData;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -130,7 +130,10 @@ public class CommandContainer {
|
|||||||
|
|
||||||
for (OptionData option : options) {
|
for (OptionData option : options) {
|
||||||
usage.append("\n");
|
usage.append("\n");
|
||||||
if (group) usage.append(" ");
|
if (group) {
|
||||||
|
usage.append(" ");
|
||||||
|
}
|
||||||
|
|
||||||
usage.append(" - ");
|
usage.append(" - ");
|
||||||
if (option.isRequired()) {
|
if (option.isRequired()) {
|
||||||
usage.append("*");
|
usage.append("*");
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ import net.dv8tion.jda.api.interactions.DiscordLocale;
|
|||||||
import net.dv8tion.jda.api.interactions.IntegrationType;
|
import net.dv8tion.jda.api.interactions.IntegrationType;
|
||||||
import net.dv8tion.jda.api.interactions.InteractionContextType;
|
import net.dv8tion.jda.api.interactions.InteractionContextType;
|
||||||
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
|
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
|
||||||
import net.dv8tion.jda.api.interactions.commands.build.*;
|
import net.dv8tion.jda.api.interactions.commands.build.Commands;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData;
|
||||||
import net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction;
|
import net.dv8tion.jda.api.interactions.commands.localization.LocalizationFunction;
|
||||||
import net.dv8tion.jda.api.interactions.commands.localization.LocalizationMap;
|
import net.dv8tion.jda.api.interactions.commands.localization.LocalizationMap;
|
||||||
import net.dv8tion.jda.api.utils.data.DataObject;
|
import net.dv8tion.jda.api.utils.data.DataObject;
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static java.util.function.Predicate.not;
|
import static java.util.function.Predicate.not;
|
||||||
import static me.bobert.netneutrality.core.command.CommandExecutionResult.Result.*;
|
import static me.bobert.netneutrality.core.command.CommandExecutionResult.Result.ERROR;
|
||||||
|
import static me.bobert.netneutrality.core.command.CommandExecutionResult.Result.NOACTION;
|
||||||
|
import static me.bobert.netneutrality.core.command.CommandExecutionResult.Result.TASK;
|
||||||
|
import static me.bobert.netneutrality.core.command.CommandExecutionResult.Result.WARN;
|
||||||
|
|
||||||
public class CommandProcessor {
|
public class CommandProcessor {
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ public abstract class MusicCommand extends AbstractCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canBeExecutedFrom(MessageChannel channel) {
|
public boolean canBeExecutedFrom(MessageChannel channel) {
|
||||||
if (channel instanceof GuildMessageChannel guildMessageChannel) {
|
if (channel instanceof GuildMessageChannel guildMessageChannel) {
|
||||||
if (channel.getType() != ChannelType.TEXT)
|
if (channel.getType() != ChannelType.TEXT) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String channelDb = GuildService.get(guildMessageChannel.getGuild()).getGuildSettingService().getSetting(GSettings.MUSIC_CHANNEL);
|
String channelDb = GuildService.get(guildMessageChannel.getGuild()).getGuildSettingService().getSetting(GSettings.MUSIC_CHANNEL);
|
||||||
if (channelDb != null && !channelDb.isEmpty()) {
|
if (channelDb != null && !channelDb.isEmpty()) {
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ package me.bobert.netneutrality.core.command.options;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.IMentionable;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||||
@@ -29,10 +33,8 @@ public interface CommandOption {
|
|||||||
* <br>This is represented as an {@link Message.Attachment#isEphemeral() ephemeral} attachment which will only be hosted for up to 2 weeks.
|
* <br>This is represented as an {@link Message.Attachment#isEphemeral() ephemeral} attachment which will only be hosted for up to 2 weeks.
|
||||||
* If you want a permanent reference, you must download it.
|
* If you want a permanent reference, you must download it.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option {@link #getType() type} is not {@link OptionType#ATTACHMENT}
|
|
||||||
*
|
|
||||||
* @return {@link net.dv8tion.jda.api.entities.Message.Attachment Attachment}
|
* @return {@link net.dv8tion.jda.api.entities.Message.Attachment Attachment}
|
||||||
|
* @throws IllegalStateException If this option {@link #getType() type} is not {@link OptionType#ATTACHMENT}
|
||||||
*/
|
*/
|
||||||
Message.Attachment getAsAttachment();
|
Message.Attachment getAsAttachment();
|
||||||
|
|
||||||
@@ -48,10 +50,8 @@ public interface CommandOption {
|
|||||||
/**
|
/**
|
||||||
* The boolean value.
|
* The boolean value.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option is not of type {@link OptionType#BOOLEAN BOOLEAN}
|
|
||||||
*
|
|
||||||
* @return The boolean value
|
* @return The boolean value
|
||||||
|
* @throws IllegalStateException If this option is not of type {@link OptionType#BOOLEAN BOOLEAN}
|
||||||
*/
|
*/
|
||||||
boolean getAsBoolean();
|
boolean getAsBoolean();
|
||||||
|
|
||||||
@@ -59,12 +59,9 @@ public interface CommandOption {
|
|||||||
* The long value for this option.
|
* The long value for this option.
|
||||||
* <br>This will be the ID of any resolved entity such as {@link Role} or {@link Member}.
|
* <br>This will be the ID of any resolved entity such as {@link Role} or {@link Member}.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option {@link #getType() type} cannot be converted to a long
|
|
||||||
* @throws NumberFormatException
|
|
||||||
* If this option is of type {@link OptionType#STRING STRING} and could not be parsed to a valid long value
|
|
||||||
*
|
|
||||||
* @return The long value
|
* @return The long value
|
||||||
|
* @throws IllegalStateException If this option {@link #getType() type} cannot be converted to a long
|
||||||
|
* @throws NumberFormatException If this option is of type {@link OptionType#STRING STRING} and could not be parsed to a valid long value
|
||||||
*/
|
*/
|
||||||
long getAsLong();
|
long getAsLong();
|
||||||
|
|
||||||
@@ -74,36 +71,27 @@ public interface CommandOption {
|
|||||||
*
|
*
|
||||||
* <p><b>It is highly recommended to assert int values by using {@link OptionData#setRequiredRange(long, long)}</b>
|
* <p><b>It is highly recommended to assert int values by using {@link OptionData#setRequiredRange(long, long)}</b>
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option {@link #getType() type} cannot be converted to a long
|
|
||||||
* @throws NumberFormatException
|
|
||||||
* If this option is of type {@link OptionType#STRING STRING} and could not be parsed to a valid long value
|
|
||||||
* @throws ArithmeticException
|
|
||||||
* If the provided integer value cannot fit into a 32bit signed int
|
|
||||||
*
|
|
||||||
* @return The int value
|
* @return The int value
|
||||||
|
* @throws IllegalStateException If this option {@link #getType() type} cannot be converted to a long
|
||||||
|
* @throws NumberFormatException If this option is of type {@link OptionType#STRING STRING} and could not be parsed to a valid long value
|
||||||
|
* @throws ArithmeticException If the provided integer value cannot fit into a 32bit signed int
|
||||||
*/
|
*/
|
||||||
int getAsInt();
|
int getAsInt();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The double value for this option.
|
* The double value for this option.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option {@link #getType() type} cannot be converted to a double
|
|
||||||
* @throws NumberFormatException
|
|
||||||
* If this option is of type {@link OptionType#STRING STRING} and could not be parsed to a valid double value
|
|
||||||
*
|
|
||||||
* @return The double value
|
* @return The double value
|
||||||
|
* @throws IllegalStateException If this option {@link #getType() type} cannot be converted to a double
|
||||||
|
* @throws NumberFormatException If this option is of type {@link OptionType#STRING STRING} and could not be parsed to a valid double value
|
||||||
*/
|
*/
|
||||||
double getAsDouble();
|
double getAsDouble();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resolved {@link IMentionable} instance for this option value.
|
* The resolved {@link IMentionable} instance for this option value.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If the mentioned entity is not resolvable
|
|
||||||
*
|
|
||||||
* @return The resolved {@link IMentionable}
|
* @return The resolved {@link IMentionable}
|
||||||
|
* @throws IllegalStateException If the mentioned entity is not resolvable
|
||||||
*/
|
*/
|
||||||
IMentionable getAsMentionable();
|
IMentionable getAsMentionable();
|
||||||
|
|
||||||
@@ -111,42 +99,34 @@ public interface CommandOption {
|
|||||||
* The resolved {@link Member} for this option value.
|
* The resolved {@link Member} for this option value.
|
||||||
* <br>Note that {@link OptionType#USER OptionType.USER} can also accept users that are not members of a guild, in which case this will be null!
|
* <br>Note that {@link OptionType#USER OptionType.USER} can also accept users that are not members of a guild, in which case this will be null!
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option is not of type {@link OptionType#USER USER} or {@link OptionType#MENTIONABLE MENTIONABLE}
|
|
||||||
*
|
|
||||||
* @return The resolved {@link Member}, or null
|
* @return The resolved {@link Member}, or null
|
||||||
|
* @throws IllegalStateException If this option is not of type {@link OptionType#USER USER} or {@link OptionType#MENTIONABLE MENTIONABLE}
|
||||||
*/
|
*/
|
||||||
Member getAsMember();
|
Member getAsMember();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resolved {@link User} for this option value.
|
* The resolved {@link User} for this option value.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option is not of type {@link OptionType#USER USER} or
|
|
||||||
* {@link OptionType#MENTIONABLE MENTIONABLE} without a resolved user
|
|
||||||
*
|
|
||||||
* @return The resolved {@link User}
|
* @return The resolved {@link User}
|
||||||
|
* @throws IllegalStateException If this option is not of type {@link OptionType#USER USER} or
|
||||||
|
* {@link OptionType#MENTIONABLE MENTIONABLE} without a resolved user
|
||||||
*/
|
*/
|
||||||
User getAsUser();
|
User getAsUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resolved {@link Role} for this option value.
|
* The resolved {@link Role} for this option value.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option is not of type {@link OptionType#ROLE ROLE} or
|
|
||||||
* {@link OptionType#MENTIONABLE MENTIONABLE} without a resolved role
|
|
||||||
*
|
|
||||||
* @return The resolved {@link Role}
|
* @return The resolved {@link Role}
|
||||||
|
* @throws IllegalStateException If this option is not of type {@link OptionType#ROLE ROLE} or
|
||||||
|
* {@link OptionType#MENTIONABLE MENTIONABLE} without a resolved role
|
||||||
*/
|
*/
|
||||||
Role getAsRole();
|
Role getAsRole();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link ChannelType} for the resolved channel.
|
* The {@link ChannelType} for the resolved channel.
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option is not of type {@link OptionType#CHANNEL CHANNEL}
|
|
||||||
*
|
|
||||||
* @return The {@link ChannelType}
|
* @return The {@link ChannelType}
|
||||||
|
* @throws IllegalStateException If this option is not of type {@link OptionType#CHANNEL CHANNEL}
|
||||||
*/
|
*/
|
||||||
ChannelType getChannelType();
|
ChannelType getChannelType();
|
||||||
|
|
||||||
@@ -154,11 +134,9 @@ public interface CommandOption {
|
|||||||
* The resolved {@link net.dv8tion.jda.api.entities.channel.middleman.GuildChannel} for this option value.
|
* The resolved {@link net.dv8tion.jda.api.entities.channel.middleman.GuildChannel} for this option value.
|
||||||
* <br>Note that {@link OptionType#CHANNEL OptionType.CHANNEL} can accept channels of any type!
|
* <br>Note that {@link OptionType#CHANNEL OptionType.CHANNEL} can accept channels of any type!
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException
|
|
||||||
* If this option is not of type {@link OptionType#CHANNEL CHANNEL}
|
|
||||||
* or could not be resolved for unexpected reasons
|
|
||||||
*
|
|
||||||
* @return The resolved {@link net.dv8tion.jda.api.entities.channel.middleman.GuildChannel}
|
* @return The resolved {@link net.dv8tion.jda.api.entities.channel.middleman.GuildChannel}
|
||||||
|
* @throws IllegalStateException If this option is not of type {@link OptionType#CHANNEL CHANNEL}
|
||||||
|
* or could not be resolved for unexpected reasons
|
||||||
*/
|
*/
|
||||||
GuildChannelUnion getAsChannel();
|
GuildChannelUnion getAsChannel();
|
||||||
}
|
}
|
||||||
+5
-1
@@ -5,7 +5,11 @@ package me.bobert.netneutrality.core.command.options;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.IMentionable;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ package me.bobert.netneutrality.core.command.options;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.IMentionable;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||||
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
import net.dv8tion.jda.api.entities.channel.unions.GuildChannelUnion;
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ package me.bobert.netneutrality.core.context;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import io.sentry.Sentry;
|
import io.sentry.Sentry;
|
||||||
import me.bobert.netneutrality.context.command.SlashCommandContext;
|
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ import net.dv8tion.jda.api.interactions.commands.build.OptionData;
|
|||||||
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
|
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
|
||||||
import net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData;
|
import net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -70,16 +75,20 @@ public abstract class CommandContext extends AbstractContext {
|
|||||||
public <T> T getOption(String name, Supplier<? extends T> fallback, Function<? super CommandOption, ? extends T> resolver) {
|
public <T> T getOption(String name, Supplier<? extends T> fallback, Function<? super CommandOption, ? extends T> resolver) {
|
||||||
Objects.requireNonNull(resolver, "resolver cannot be null");
|
Objects.requireNonNull(resolver, "resolver cannot be null");
|
||||||
CommandOption mapping = getOption(name);
|
CommandOption mapping = getOption(name);
|
||||||
if (mapping != null)
|
if (mapping != null) {
|
||||||
return resolver.apply(mapping);
|
return resolver.apply(mapping);
|
||||||
|
}
|
||||||
|
|
||||||
return fallback == null ? null : fallback.get();
|
return fallback == null ? null : fallback.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T getOption(String name, T fallback, Function<? super CommandOption, ? extends T> resolver) {
|
public <T> T getOption(String name, T fallback, Function<? super CommandOption, ? extends T> resolver) {
|
||||||
Objects.requireNonNull(resolver, "resolver cannot be null");
|
Objects.requireNonNull(resolver, "resolver cannot be null");
|
||||||
CommandOption mapping = getOption(name);
|
CommandOption mapping = getOption(name);
|
||||||
if (mapping != null)
|
if (mapping != null) {
|
||||||
return resolver.apply(mapping);
|
return resolver.apply(mapping);
|
||||||
|
}
|
||||||
|
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +141,4 @@ public abstract class CommandContext extends AbstractContext {
|
|||||||
public abstract String parseCommandName();
|
public abstract String parseCommandName();
|
||||||
|
|
||||||
public abstract String getFullCommand();
|
public abstract String getFullCommand();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,11 @@ package me.bobert.netneutrality.core.context;
|
|||||||
import me.bobert.netneutrality.context.AsyncContext;
|
import me.bobert.netneutrality.context.AsyncContext;
|
||||||
import me.bobert.netneutrality.utils.ContextUtils;
|
import me.bobert.netneutrality.utils.ContextUtils;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.entities.*;
|
import net.dv8tion.jda.api.entities.Guild;
|
||||||
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||||
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import net.dv8tion.jda.api.events.Event;
|
import net.dv8tion.jda.api.events.Event;
|
||||||
|
|||||||
@@ -29,8 +29,12 @@ public abstract class AbstractTask implements Task {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AbstractTask that = (AbstractTask) o;
|
AbstractTask that = (AbstractTask) o;
|
||||||
return Objects.equals(getId(), that.getId());
|
return Objects.equals(getId(), that.getId());
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public interface Task {
|
|||||||
REMOVE_SELF,
|
REMOVE_SELF,
|
||||||
REMOVE_SELF_AND_CHILDREN
|
REMOVE_SELF_AND_CHILDREN
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method should generate a unique ID to differentiate it from other tasks.
|
* This method should generate a unique ID to differentiate it from other tasks.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -44,6 +45,7 @@ public interface Task {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This is only used for debugging purpose.
|
* This is only used for debugging purpose.
|
||||||
|
*
|
||||||
* @return Name of the task
|
* @return Name of the task
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
@@ -55,6 +57,7 @@ public interface Task {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When this returns true, the task will get removed by the cleanup thread.
|
* When this returns true, the task will get removed by the cleanup thread.
|
||||||
|
*
|
||||||
* @return If the task is expired
|
* @return If the task is expired
|
||||||
*/
|
*/
|
||||||
boolean isExpired();
|
boolean isExpired();
|
||||||
@@ -71,6 +74,7 @@ public interface Task {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the task.
|
* Executes the task.
|
||||||
|
*
|
||||||
* @param context The context for this task.
|
* @param context The context for this task.
|
||||||
*/
|
*/
|
||||||
Lifecycle execute(TaskContext context);
|
Lifecycle execute(TaskContext context);
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ import org.reflections.Reflections;
|
|||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.*;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ package me.bobert.netneutrality.core.thread;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class ThreadManager {
|
public class ThreadManager {
|
||||||
|
|
||||||
@@ -38,11 +42,9 @@ public class ThreadManager {
|
|||||||
ex.shutdown();
|
ex.shutdown();
|
||||||
ex.awaitTermination(1, TimeUnit.SECONDS);
|
ex.awaitTermination(1, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
}
|
} catch (InterruptedException e) {
|
||||||
catch (InterruptedException e) {
|
|
||||||
System.err.println("[Executor] Running tasks interrupted");
|
System.err.println("[Executor] Running tasks interrupted");
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
executors.forEach((name, ex) -> {
|
executors.forEach((name, ex) -> {
|
||||||
if (!ex.isTerminated()) {
|
if (!ex.isTerminated()) {
|
||||||
System.err.println("[Executor: " + name + "] Forcing shutdown of running tasks..");
|
System.err.println("[Executor: " + name + "] Forcing shutdown of running tasks..");
|
||||||
|
|||||||
@@ -6,7 +6,15 @@ package me.bobert.netneutrality.db.entities;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "blacklist")
|
@Table(name = "blacklist")
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ package me.bobert.netneutrality.db.entities;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|||||||
@@ -6,7 +6,18 @@ package me.bobert.netneutrality.db.entities;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.NamedQueries;
|
||||||
|
import jakarta.persistence.NamedQuery;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "guild_settings")
|
@Table(name = "guild_settings")
|
||||||
|
|||||||
@@ -6,7 +6,16 @@ package me.bobert.netneutrality.db.entities;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Convert;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,14 @@ package me.bobert.netneutrality.db.entities;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.MapsId;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "logging")
|
@Table(name = "logging")
|
||||||
|
|||||||
@@ -46,8 +46,12 @@ public class OLoggingId implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) {
|
||||||
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
OLoggingId entity = (OLoggingId) o;
|
OLoggingId entity = (OLoggingId) o;
|
||||||
return Objects.equals(this.guildId, entity.guildId) &&
|
return Objects.equals(this.guildId, entity.guildId) &&
|
||||||
Objects.equals(this.channelId, entity.channelId);
|
Objects.equals(this.channelId, entity.channelId);
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ package me.bobert.netneutrality.db.entities;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.persistence.UniqueConstraint;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "tasks", uniqueConstraints = {@UniqueConstraint(columnNames = {"task_id"})})
|
@Table(name = "tasks", uniqueConstraints = {@UniqueConstraint(columnNames = {"task_id"})})
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ package me.bobert.netneutrality.db.entities;
|
|||||||
* https://discord.gg/qUa6zNFZsd
|
* https://discord.gg/qUa6zNFZsd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.Lob;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|||||||
@@ -53,8 +53,12 @@ public class EventsHandler implements EventListener {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
addListener(MessageReceivedEvent.class, event -> {
|
addListener(MessageReceivedEvent.class, event -> {
|
||||||
if (event.getAuthor().isBot()) return null;
|
if (event.getAuthor().isBot()) {
|
||||||
if (event.isWebhookMessage()) return null;
|
return null;
|
||||||
|
}
|
||||||
|
if (event.isWebhookMessage()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
String rawMessage = message.getContentDisplay().trim();
|
String rawMessage = message.getContentDisplay().trim();
|
||||||
|
|||||||
@@ -10,14 +10,23 @@ import com.google.gson.Gson;
|
|||||||
import io.sentry.Breadcrumb;
|
import io.sentry.Breadcrumb;
|
||||||
import io.sentry.Sentry;
|
import io.sentry.Sentry;
|
||||||
import me.bobert.netneutrality.utils.Settings;
|
import me.bobert.netneutrality.utils.Settings;
|
||||||
import okhttp3.*;
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class WebModule {
|
public class WebModule {
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ import net.dv8tion.jda.api.entities.Member;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.LinkedBlockingDeque;
|
import java.util.concurrent.LinkedBlockingDeque;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
|||||||
@@ -37,23 +37,29 @@ public class SourceFinder {
|
|||||||
Matcher udioMatcher = udioPattern.matcher(url);
|
Matcher udioMatcher = udioPattern.matcher(url);
|
||||||
Matcher mp3Matcher = mp3Pattern.matcher(url);
|
Matcher mp3Matcher = mp3Pattern.matcher(url);
|
||||||
|
|
||||||
if (youtubeMatcher.find())
|
if (youtubeMatcher.find()) {
|
||||||
return AudioSourceType.Youtube;
|
return AudioSourceType.Youtube;
|
||||||
|
}
|
||||||
|
|
||||||
if (youtubeMusicMatcher.find())
|
if (youtubeMusicMatcher.find()) {
|
||||||
return AudioSourceType.YTMusic;
|
return AudioSourceType.YTMusic;
|
||||||
|
}
|
||||||
|
|
||||||
if (soundcloudMatcher.find())
|
if (soundcloudMatcher.find()) {
|
||||||
return AudioSourceType.Soundcloud;
|
return AudioSourceType.Soundcloud;
|
||||||
|
}
|
||||||
|
|
||||||
if (udioMatcher.find())
|
if (udioMatcher.find()) {
|
||||||
return AudioSourceType.Udio;
|
return AudioSourceType.Udio;
|
||||||
|
}
|
||||||
|
|
||||||
if (mp3Matcher.find())
|
if (mp3Matcher.find()) {
|
||||||
return AudioSourceType.DirectLinkMp3;
|
return AudioSourceType.DirectLinkMp3;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(url.startsWith("http://") || url.startsWith("https://")))
|
if (!(url.startsWith("http://") || url.startsWith("https://"))) {
|
||||||
return AudioSourceType.YTSearch;
|
return AudioSourceType.YTSearch;
|
||||||
|
}
|
||||||
|
|
||||||
return AudioSourceType.Nothing;
|
return AudioSourceType.Nothing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,12 @@ public class TrackInfo {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
TrackInfo trackInfo = (TrackInfo) o;
|
TrackInfo trackInfo = (TrackInfo) o;
|
||||||
return track.equals(trackInfo.track);
|
return track.equals(trackInfo.track);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
|||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
import me.bobert.netneutrality.core.LogHandler;
|
import me.bobert.netneutrality.core.LogHandler;
|
||||||
import me.bobert.netneutrality.core.context.CommandContext;
|
import me.bobert.netneutrality.core.context.CommandContext;
|
||||||
import me.bobert.netneutrality.core.tasks.TaskManager;
|
|
||||||
import me.bobert.netneutrality.tasks.music.LoadPlaylistTask;
|
import me.bobert.netneutrality.tasks.music.LoadPlaylistTask;
|
||||||
import me.bobert.netneutrality.utils.MessageFunction;
|
import me.bobert.netneutrality.utils.MessageFunction;
|
||||||
import me.bobert.netneutrality.utils.MusicUtils;
|
import me.bobert.netneutrality.utils.MusicUtils;
|
||||||
@@ -64,9 +63,10 @@ public class TrackLoadingHandler implements AudioLoadResultHandler {
|
|||||||
public void noMatches() {
|
public void noMatches() {
|
||||||
logger.debug("Guild {}: no matches for identifier {}", guild.getId(), identifier);
|
logger.debug("Guild {}: no matches for identifier {}", guild.getId(), identifier);
|
||||||
|
|
||||||
if (!silent)
|
if (!silent) {
|
||||||
context.reply("No matches found");
|
context.reply("No matches found");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadFailed(FriendlyException e) {
|
public void loadFailed(FriendlyException e) {
|
||||||
@@ -76,7 +76,8 @@ public class TrackLoadingHandler implements AudioLoadResultHandler {
|
|||||||
RuntimeException exception = new RuntimeException("Failed to load track: " + e.getMessage(), e);
|
RuntimeException exception = new RuntimeException("Failed to load track: " + e.getMessage(), e);
|
||||||
LogHandler.log(exception);
|
LogHandler.log(exception);
|
||||||
|
|
||||||
if (!silent)
|
if (!silent) {
|
||||||
context.reply(MessageFunction.buildSentryErrorMessage(exception));
|
context.reply(MessageFunction.buildSentryErrorMessage(exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -35,13 +35,9 @@ import java.util.regex.Pattern;
|
|||||||
import static com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity.SUSPICIOUS;
|
import static com.sedmelluq.discord.lavaplayer.tools.FriendlyException.Severity.SUSPICIOUS;
|
||||||
|
|
||||||
public class UdioAudioSourceManager implements AudioSourceManager {
|
public class UdioAudioSourceManager implements AudioSourceManager {
|
||||||
|
|
||||||
private static final Logger log = LogManager.getLogger(UdioAudioSourceManager.class);
|
private static final Logger log = LogManager.getLogger(UdioAudioSourceManager.class);
|
||||||
|
|
||||||
|
|
||||||
private static final String TRACK_URL_REGEX = "^https://www.udio.com/songs/[0-9A-Za-z]+$";
|
private static final String TRACK_URL_REGEX = "^https://www.udio.com/songs/[0-9A-Za-z]+$";
|
||||||
private static final Pattern trackUrlPattern = Pattern.compile(TRACK_URL_REGEX);
|
private static final Pattern trackUrlPattern = Pattern.compile(TRACK_URL_REGEX);
|
||||||
|
|
||||||
private final HttpInterfaceManager httpInterfaceManager;
|
private final HttpInterfaceManager httpInterfaceManager;
|
||||||
|
|
||||||
public UdioAudioSourceManager() {
|
public UdioAudioSourceManager() {
|
||||||
@@ -64,11 +60,8 @@ public class UdioAudioSourceManager implements AudioSourceManager {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new FriendlyException("Loading Udio track information failed.", SUSPICIOUS, e);
|
throw new FriendlyException("Loading Udio track information failed.", SUSPICIOUS, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrackEncodable(AudioTrack track) {
|
public boolean isTrackEncodable(AudioTrack track) {
|
||||||
return true;
|
return true;
|
||||||
@@ -94,7 +87,6 @@ public class UdioAudioSourceManager implements AudioSourceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private AudioItem loadFromTrackPage(HttpInterface httpInterface, String trackUrl) throws IOException {
|
private AudioItem loadFromTrackPage(HttpInterface httpInterface, String trackUrl) throws IOException {
|
||||||
|
|
||||||
try (CloseableHttpResponse response = httpInterface.execute(new HttpGet(trackUrl))) {
|
try (CloseableHttpResponse response = httpInterface.execute(new HttpGet(trackUrl))) {
|
||||||
int statusCode = response.getStatusLine().getStatusCode();
|
int statusCode = response.getStatusLine().getStatusCode();
|
||||||
|
|
||||||
@@ -124,7 +116,6 @@ public class UdioAudioSourceManager implements AudioSourceManager {
|
|||||||
String artworkUrl = getArtworkUrlFromImagePath(trackInfo);
|
String artworkUrl = getArtworkUrlFromImagePath(trackInfo);
|
||||||
|
|
||||||
AudioTrackInfo audioTrackInfo = new AudioTrackInfo(title, artist, duration, trackUrl, false, playbackUrl, artworkUrl, null);
|
AudioTrackInfo audioTrackInfo = new AudioTrackInfo(title, artist, duration, trackUrl, false, playbackUrl, artworkUrl, null);
|
||||||
|
|
||||||
return new UdioAudioTrack(audioTrackInfo, this);
|
return new UdioAudioTrack(audioTrackInfo, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,5 +146,4 @@ public class UdioAudioSourceManager implements AudioSourceManager {
|
|||||||
|
|
||||||
return imagePath.replace("public", artworkOptions);
|
return imagePath.replace("public", artworkOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ import java.util.function.Function;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A generic button task that represents a button to accept a choice.
|
* A generic button task that represents a button to accept a choice.
|
||||||
|
*
|
||||||
* @param <P> the type of the parent task, which must implement WithChildren
|
* @param <P> the type of the parent task, which must implement WithChildren
|
||||||
*/
|
*/
|
||||||
public class AcceptButton<P extends WithChildren> extends ButtonTask implements WithParent<P>, NotAcknowledgeable {
|
public class AcceptButton<P extends WithChildren> extends ButtonTask implements WithParent<P>, NotAcknowledgeable {
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ public class ChannelMessagePurger {
|
|||||||
|
|
||||||
public boolean canLockBeAcquired() {
|
public boolean canLockBeAcquired() {
|
||||||
boolean acquired = lock.tryLock();
|
boolean acquired = lock.tryLock();
|
||||||
if (acquired)
|
if (acquired) {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
return acquired;
|
return acquired;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,10 +29,11 @@ import org.apache.commons.lang3.time.DurationFormatUtils;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
|
|
||||||
public class MessageFunction {
|
public class MessageFunction {
|
||||||
|
|
||||||
@@ -137,7 +138,9 @@ public class MessageFunction {
|
|||||||
message.append("- ").append(info.title);
|
message.append("- ").append(info.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == limit) break;
|
if (index == limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return message.toString();
|
return message.toString();
|
||||||
@@ -162,7 +165,9 @@ public class MessageFunction {
|
|||||||
message.addField("Track #" + ++index, info.title, false);
|
message.addField("Track #" + ++index, info.title, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == 10) break;
|
if (index == 10) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
message.setTimestamp(OffsetDateTime.now());
|
message.setTimestamp(OffsetDateTime.now());
|
||||||
|
|
||||||
|
|||||||
@@ -71,8 +71,9 @@ public class Settings {
|
|||||||
public String get(String key, String def) {
|
public String get(String key, String def) {
|
||||||
String property = get(key);
|
String property = get(key);
|
||||||
|
|
||||||
if (property == null || property.isEmpty())
|
if (property == null || property.isEmpty()) {
|
||||||
return def;
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,8 @@ public class Settings {
|
|||||||
p.load(is);
|
p.load(is);
|
||||||
version = p.getProperty("app.version", "");
|
version = p.getProperty("app.version", "");
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
version = "0.0.0";
|
version = "0.0.0";
|
||||||
|
|||||||
@@ -25,9 +25,10 @@ public class UserFunction {
|
|||||||
public static boolean isAdmin(Member user) {
|
public static boolean isAdmin(Member user) {
|
||||||
boolean isAdmin = false;
|
boolean isAdmin = false;
|
||||||
for (Role role : user.getRoles()) {
|
for (Role role : user.getRoles()) {
|
||||||
if (role.getPermissions().contains(Permission.MANAGE_SERVER) || role.getPermissions().contains(Permission.ADMINISTRATOR))
|
if (role.getPermissions().contains(Permission.MANAGE_SERVER) || role.getPermissions().contains(Permission.ADMINISTRATOR)) {
|
||||||
isAdmin = true;
|
isAdmin = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return isAdmin;
|
return isAdmin;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user