sxcybot

OSRS oriented Discord Bot
git clone git://git.wimdupont.com/sxcybot.git
Log | Files | Refs | README | LICENSE

commit ce766d042cec44879926df644ee6bffd126bb0fd
parent dff359707f38a77f40ad7f2fca4a49421075b22f
Author: WimDupont <WimDupont@users.noreply.gitlab.com>
Date:   Fri,  5 Nov 2021 19:23:15 +0100

releasnotes to csv and version bump

Diffstat:
M.gitignore | 4+++-
Mpom.xml | 11++++++++---
Msrc/main/java/com/sxcy/sxcybot/util/ReleaseNotesUtil.java | 21+++++++++++++++++++--
Asrc/main/resources/releasenotes.csv | 1+
Msrc/main/resources/todo.adoc | 6++++--
Msrc/test/java/com/sxcy/sxcybot/SxcyBotApplicationTests.java | 2+-
6 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -34,4 +34,6 @@ build/ ### Spring Profile properties ### /src/main/resources/application-*.properties -/src/test/java/scripts/testdata.sql + +### Script to provide db with testdata ### +/src/test/java/com/sxcy/sxcybot/scripts/testdata.sql diff --git a/pom.xml b/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> - <version>2.3.5.RELEASE</version> + <version>2.5.6</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.sxcy</groupId> @@ -54,7 +54,7 @@ <dependency> <groupId>org.easymock</groupId> <artifactId>easymock</artifactId> - <version>4.2</version> + <version>4.3</version> <scope>test</scope> </dependency> <dependency> @@ -64,7 +64,7 @@ <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-maven-plugin</artifactId> - <version>7.3.1</version> + <version>8.0.1</version> </dependency> </dependencies> @@ -105,6 +105,11 @@ <name>m2-dv8tion</name> <url>https://m2.dv8tion.net/releases</url> </repository> + <repository> + <id>maven_central</id> + <name>Maven Central</name> + <url>https://repo.maven.apache.org/maven2/</url> + </repository> </repositories> <profiles> <profile> diff --git a/src/main/java/com/sxcy/sxcybot/util/ReleaseNotesUtil.java b/src/main/java/com/sxcy/sxcybot/util/ReleaseNotesUtil.java @@ -4,16 +4,24 @@ package com.sxcy.sxcybot.util; import com.sxcy.sxcybot.services.guild.ChannelDetailService; import lombok.NonNull; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.JDA; import org.springframework.stereotype.Component; -import java.awt.*; +import java.awt.Color; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Paths; import java.time.LocalDate; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; +@Slf4j @Component @RequiredArgsConstructor public class ReleaseNotesUtil { @@ -42,7 +50,16 @@ public class ReleaseNotesUtil { private static Map<String, String> getReleaseNotes() { Map<String, String> releaseNotes = new LinkedHashMap<>(); - releaseNotes.put("Added Phosani's Nightmare", "Bosses HiScores has been updated to also include Phosani's Nightmare."); + try { + URL file = Optional.ofNullable(ReleaseNotesUtil.class.getResource("/releasenotes.csv")) + .orElseThrow(() -> new IOException("File releasenotes.csv not found!")); + Files.lines(Paths.get(file.toURI())).forEach(line -> { + if (!line.isEmpty()) + releaseNotes.put(line.split(";")[0], line.split(";")[1].trim()); + }); + } catch (URISyntaxException | IOException e) { + log.error(e.getMessage(), e); + } return releaseNotes; } } diff --git a/src/main/resources/releasenotes.csv b/src/main/resources/releasenotes.csv @@ -0,0 +1 @@ +Changed releasenotes generation;Releasenotes are now generated by csv file instead of in-line code. diff --git a/src/main/resources/todo.adoc b/src/main/resources/todo.adoc @@ -7,6 +7,9 @@ .Technical * Logging +* Fix PvM roles +** If players get skipped their points get accumulated way too much the next time they are found. +* Add commands to check PvM roles progress in PM's * Make boss changes updateable without breaking code (hiscoreClient indexes are hardcoded) * Make new channel startups easier (especially channel_detail and guild_role inserts) @@ -16,4 +19,4 @@ * Single instance can run multiple channels -== Additional notes -\ No newline at end of file +== Additional notes diff --git a/src/test/java/com/sxcy/sxcybot/SxcyBotApplicationTests.java b/src/test/java/com/sxcy/sxcybot/SxcyBotApplicationTests.java @@ -1,6 +1,6 @@ package com.sxcy.sxcybot; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles;