Compare commits

..

2 Commits

Author SHA1 Message Date
Renovate Bot
c28a476682
Update dependency org.jsoup:jsoup to v1.15.1 2022-05-15 09:22:51 +00:00
239d89e42a Almost fix music 2022-05-14 19:26:08 +02:00
4 changed files with 64 additions and 30 deletions

View File

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

View File

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

View File

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

View File

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