Compare commits

..

4 Commits

Author SHA1 Message Date
Renovate Bot
2656266a57
Update dependency org.jsoup:jsoup to v1.15.1 2022-05-15 14:50:52 +00:00
12230218df
Disable plain jar 2022-05-15 16:49:55 +02:00
35093a1bd1
Fix build 2022-05-15 16:40:00 +02:00
4118116ee9
Migrate music to slash command 2022-05-15 14:37:20 +02:00
4 changed files with 30 additions and 64 deletions

View File

@ -17,10 +17,10 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
@ -35,8 +35,9 @@ jobs:
path: build/libs/
build-docker:
runs-on: [ ubuntu-latest ]
needs: [ build-gradle ]
runs-on: ubuntu-latest
needs:
- build-gradle
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2

View File

@ -1,4 +1,4 @@
FROM openjdk:8-jre-buster
FROM openjdk:17.0.2
WORKDIR /bot_src
ARG BUILD_NBR
ARG BRANCH_NAME
@ -6,7 +6,5 @@ ARG BRANCH_NAME
ARG GITHUB_RUN_NUMBER
ADD build/libs/ClaptrapBot-*.jar /bot_src/bot.jar
RUN java -version
ENV PORT=8080
ENV TOKEN=10
CMD java -jar bot.jar -t ${TOKEN}
CMD java -jar bot.jar
LABEL org.opencontainers.image.source=https://github.com/Sebclem/ClaptrapBot/

View File

@ -15,26 +15,15 @@ version = "$versionObj"
sourceCompatibility = '17'
jar.doFirst {
delete "${buildDir}/libs/*"
}
jar {
// delete "${buildDir}/libs/*"
// baseName = 'DiscordBot'
}
repositories {
mavenCentral()
jcenter()
maven {
url 'https://m2.dv8tion.net/releases'
}
}
jar{
enabled(false)
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web"){

View File

@ -55,42 +55,20 @@ public class Music implements SlashCommand {
event.getHook().sendMessage(message).queue();
}
break;
// case "add":
// event.getTextChannel().sendTyping().queue();
// if(args.length ==2){
// audio.add(event,args[1],30,false);
// }
// else if(args.length == 3){
// try{
// int limit = Integer.parseInt(args[2]);
// audio.add(event,args[1],limit,false);
// }catch (NumberFormatException e){
// audio.add(event,args[1],30,false);
// }
// }
// else{
// Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Missing argument!")).complete();
// List<Message> messages = new ArrayList<Message>(){{
// add(message);
// add(event.getMessage());
// }};
// new MessageTimeOut(messages, MainBot.messageTimeOut).start();
// }
// break;
// case "addNext":
// event.getTextChannel().sendTyping().queue();
// if(args.length >=2){
// audio.add(event,args[1],1,true);
// }
// else{
// Message message = event.getTextChannel().sendMessage(EmbedMessageUtils.getMusicError("Missing argument!")).complete();
// List<Message> messages = new ArrayList<Message>(){{
// add(message);
// add(event.getMessage());
// }};
// new MessageTimeOut(messages, MainBot.messageTimeOut).start();
// }
// break;
case "add":
OptionMapping url = event.getOption("url");
boolean next = false;
if(event.getOption("next") != null){
next = event.getOption("next").getAsBoolean();
}
if(event.getOption("playlist-limit") == null){
audio.add(event, url.getAsString(),30, next);
}
else{
long limit = event.getOption("playlist-limit").getAsLong();
audio.add(event, url.getAsString(), (int) limit, next);
}
break;
case "pause":
audio.pause(event);
break;
@ -114,8 +92,6 @@ public class Music implements SlashCommand {
audio.list(event);
break;
}
}
@Override
@ -131,11 +107,13 @@ public class Music implements SlashCommand {
@Override
public List<SubcommandData> getSubcommands() {
ArrayList<SubcommandData> subCommandList = new ArrayList<>();
subCommandList.add(new SubcommandData("play", "Play somme music")
subCommandList.add(new SubcommandData("play", "Play music")
.addOption(OptionType.STRING, "url", "The URL of the video to play", true)
.addOption(OptionType.INTEGER, "playlist-limit", "If a playlist is loaded, enter the max number of loaded tracks"));
subCommandList.add(new SubcommandData("add", "Add music to queue")
.addOption(OptionType.STRING, "url", " The URL of the video to play", true));
.addOption(OptionType.INTEGER, "playlist-limit", "If a playlist is loaded, enter the max number of loaded tracks (default to 30)"));
subCommandList.add(new SubcommandData("add", "Add track to queue")
.addOption(OptionType.STRING, "url", " The URL of the video to play", true)
.addOption(OptionType.BOOLEAN, "next", "If true, track will be added on top of the playlist and will be the next to play")
.addOption(OptionType.INTEGER, "playlist-limit", "If a playlist is loaded, enter the max number of loaded tracks (default to 30)"));
subCommandList.add(new SubcommandData("pause", "Pause playback"));
subCommandList.add(new SubcommandData("resume", "Resume playback"));
subCommandList.add(new SubcommandData("stop", "Stop playback"));