Skip to content

Commit

Permalink
Release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rettichlp committed Sep 25, 2024
2 parents 97c992d + 2e12057 commit b8c2dd4
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 20 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help me improve
title: SBB - [title]
labels: bug
assignees: rettichlp

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: SBF - [title]
labels: enhancement
assignees: rettichlp

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
push:
branches: [ "develop" ]

run-name: Build+${{ github.run_number }} ${{ github.ref_name }}/${{ github.sha }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deploy

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to be deployed (e.g. develop)'
required: true

run-name: Deploy+${{ github.run_number }} ${{ github.ref_name }}/${{ github.sha }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
deploy:

name: 🔨 Deploy Discord Bot
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- name: Update project version
run: mvn versions:set -DnewVersion="Build+${{ github.run_number }} ${{ github.ref_name }}/${{ github.sha }}"

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: maven

- name: Set application properties
env:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
LOGGING_BOT_TOKEN: ${{ secrets.LOGGING_BOT_TOKEN }}
run: |
echo "discord.bot.token=$DISCORD_BOT_TOKEN" >> src/main/resources/application.properties
echo "logging.bot.token=$LOGGING_BOT_TOKEN" >> src/main/resources/application.properties
- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Upload application via SCP
uses: appleboy/scp-action@v0.1.7
with:
host: rettichlp.de
username: shantybot
key: ${{ secrets.SSH_KEY }}
port: 22
source: "target/shantybot.jar"
target: "/home/shantybot"
timeout: 120s
strip_components: 1

- name: Restart application
uses: appleboy/ssh-action@v1.0.3
with:
host: rettichlp.de
username: shantybot
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
cd /home/shantybot
./run.sh
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:

run-name: Create release v${{ inputs.version }}

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
release:

Expand All @@ -35,8 +35,6 @@ jobs:
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
- name: Update project version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn versions:set -DnewVersion=${{ inputs.version }}

- name: Commit and merge develop branch to main
Expand Down
File renamed without changes.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ The bot will ask for these permissions:

With these permissions the bot has access to following activities:

![](https://private-user-images.githubusercontent.com/97811064/355839024-aa4e9f31-4852-4d71-b57c-fc3d3a416472.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwMzgxNTMsIm5iZiI6MTcyMzAzNzg1MywicGF0aCI6Ii85NzgxMTA2NC8zNTU4MzkwMjQtYWE0ZTlmMzEtNDg1Mi00ZDcxLWI1N2MtZmMzZDNhNDE2NDcyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA3VDEzMzczM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUwMmFiMTU5ODdlOThhYTFlY2U3YjgzOGM1ZTJkZWQxMWMxNDZiNjk0YjBiNDIzYjgyNzNiNDA4ZGMzZWNhOGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.QGpqYJL29ol7zK5hJ_FRYgvAkj1T7mwmYmmNUiGxFo4)
![](https://i.imgur.com/pcLV4cY.png)

## Commands

The bot provides the following slash commands:

| Command | Description |
|----------------------------------|-----------------------------------------------------------------------|
| `/löschen` `amount` | Deletes the last \<amount> messages in the current channel |
| `/play` `search query` or `link` | Searches for a song on YouTube or via link (YouTube, Soundcloud, ...) |
| `/version` | Shows the current version of the bot |
| Command | Description |
|-----------------------------------|-----------------------------------------------------------------------------|
| `/löschen` `amount` | Deletes the last \<amount> messages in the current channel |
| `/befehle` | Shows all available commands of the ShantyBot |
| `/ip` | Shows the IP, version and additional information about the Minecraft server |
| `/musik` `search query` or `link` | Searches for a song on YouTube or via link (YouTube, Soundcloud, ...) |
| `/spieler` | Shows the number of players currently on the Minecraft server |
| `/version` | Shows the current version of the bot |
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.2</version>
<version>3.3.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>de.rettichlp</groupId>
<artifactId>shantybot</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<packaging>jar</packaging>

<name>ShantyBot</name>
Expand Down Expand Up @@ -69,28 +69,28 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.2</version>
<version>5.1.1</version>
</dependency>

<!-- https://github.com/lavalink-devs/lavaplayer -->
<dependency>
<groupId>dev.arbjerg</groupId>
<artifactId>lavaplayer</artifactId>
<version>2.2.1</version>
<version>2.2.2</version>
</dependency>

<!-- https://github.com/lavalink-devs/youtube-source -->
<dependency>
<groupId>dev.lavalink.youtube</groupId>
<artifactId>common</artifactId>
<version>1.6.0</version>
<version>1.8.2</version>
</dependency>

<!-- https://maven.rettichlp.de/#/releases/de/rettichlp/dclogging -->
<dependency>
<groupId>de.rettichlp</groupId>
<artifactId>dclogging</artifactId>
<version>1.1.6</version>
<version>2.0.0</version>
</dependency>
</dependencies>

Expand Down
10 changes: 9 additions & 1 deletion src/main/java/de/rettichlp/shantybot/ShantyBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import static java.lang.Runtime.getRuntime;
import static java.lang.System.currentTimeMillis;
import static java.lang.Thread.setDefaultUncaughtExceptionHandler;
import static java.util.Optional.ofNullable;
import static net.dv8tion.jda.api.Permission.MESSAGE_MANAGE;
import static net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions.enabledFor;
Expand All @@ -51,9 +52,16 @@ public class ShantyBot implements WebMvcConfigurer {

public static void main(String[] args) throws InterruptedException {
ConfigurableApplicationContext context = run(ShantyBot.class, args);

setDefaultUncaughtExceptionHandler((thread, exception) -> {
String exceptionMessage = exception.getMessage();
log.error(exceptionMessage, exception);
discordLogging.error(exceptionMessage, exception);
});

discordBotProperties = context.getBean(DiscordBotProperties.class);

discordLogging = DiscordLogging.getBuilder()
discordLogging = DiscordLogging.builder()
.botToken(discordBotProperties.getLoggingToken())
.guildId(discordBotProperties.getLoggingGuildId())
.textChannelId(discordBotProperties.getLoggingTextChannel())
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/rettichlp/shantybot/common/api/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private ResponseEntity<String> sendRequest() {
HttpStatusCode statusCode = ex.getStatusCode();
if (!statusCode.is4xxClientError()) {
log.error("Request failed with code {}: {}", statusCode, responseBodyAsString);
discordLogging.error("Request failed with code " + statusCode + ": " + responseBodyAsString);
discordLogging.error("Request failed with code {}: {}", statusCode, responseBodyAsString);
}

return just(ResponseEntity.status(statusCode).body(responseBodyAsString));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void deleteOldLogEntries() {

allOf(futures.toArray(new CompletableFuture[0])).thenRun(() -> log.info("Discord role synchronising: finished in {}ms", currentTimeMillis() - startTime)).exceptionally(error -> {
log.error("Discord role synchronising: failed - {}", error.getMessage());
discordLogging.error("Discord role synchronising: failed - " + error.getMessage());
discordLogging.error("Discord role synchronising: failed - {}", error.getMessage());
return null;
});
}, () -> {
Expand Down

0 comments on commit b8c2dd4

Please sign in to comment.