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: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up JDK 1.8 - name: Set up JDK 17
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 17
- name: Grant execute permission for gradlew - name: Grant execute permission for gradlew
run: chmod +x gradlew run: chmod +x gradlew
@ -35,8 +35,9 @@ jobs:
path: build/libs/ path: build/libs/
build-docker: build-docker:
runs-on: [ ubuntu-latest ] runs-on: ubuntu-latest
needs: [ build-gradle ] needs:
- 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:8-jre-buster FROM openjdk:17.0.2
WORKDIR /bot_src WORKDIR /bot_src
ARG BUILD_NBR ARG BUILD_NBR
ARG BRANCH_NAME ARG BRANCH_NAME
@ -6,7 +6,5 @@ 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
ENV PORT=8080 CMD java -jar bot.jar
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,26 +15,15 @@ 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,42 +55,20 @@ public class Music implements SlashCommand {
event.getHook().sendMessage(message).queue(); event.getHook().sendMessage(message).queue();
} }
break; break;
// case "add": case "add":
// event.getTextChannel().sendTyping().queue(); OptionMapping url = event.getOption("url");
// if(args.length ==2){ boolean next = false;
// audio.add(event,args[1],30,false); if(event.getOption("next") != null){
// } next = event.getOption("next").getAsBoolean();
// else if(args.length == 3){ }
// try{ if(event.getOption("playlist-limit") == null){
// int limit = Integer.parseInt(args[2]); audio.add(event, url.getAsString(),30, next);
// audio.add(event,args[1],limit,false); }
// }catch (NumberFormatException e){ else{
// audio.add(event,args[1],30,false); long limit = event.getOption("playlist-limit").getAsLong();
// } audio.add(event, url.getAsString(), (int) limit, next);
// } }
// else{ break;
// 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;
@ -114,8 +92,6 @@ public class Music implements SlashCommand {
audio.list(event); audio.list(event);
break; break;
} }
} }
@Override @Override
@ -131,11 +107,13 @@ 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 somme music") subCommandList.add(new SubcommandData("play", "Play 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")); .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 music to queue") subCommandList.add(new SubcommandData("add", "Add track 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"));