From fd74a955f039b68da979f18627956640d0541625 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Thu, 13 May 2021 11:18:34 +0200 Subject: [PATCH] Changed snowflakes from text to long lint Signed-off-by: Louis Vallat --- MoviesQuoteBot.sql | 4 ++-- src/main/java/xyz/vallat/louis/MoviesQuoteBot.java | 2 +- src/main/java/xyz/vallat/louis/commands/Version.java | 4 ++-- .../xyz/vallat/louis/database/SubtitleLineManager.java | 8 ++++---- .../java/xyz/vallat/louis/database/SubtitleManager.java | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/MoviesQuoteBot.sql b/MoviesQuoteBot.sql index 27add9d..2ef7056 100644 --- a/MoviesQuoteBot.sql +++ b/MoviesQuoteBot.sql @@ -52,8 +52,8 @@ CREATE TABLE IF NOT EXISTS subtitles id int GENERATED ALWAYS AS IDENTITY, film_id int NOT NULL, language_id int NOT NULL, - importer_id varchar(37), - importer_guild_id text, + importer_id bigint, + importer_guild_id bigint, imported_date timestamptz NOT NULL DEFAULT now(), UNIQUE (film_id, language_id), PRIMARY KEY (id), diff --git a/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java b/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java index 70d2036..dbc66b4 100644 --- a/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java +++ b/src/main/java/xyz/vallat/louis/MoviesQuoteBot.java @@ -23,7 +23,7 @@ public class MoviesQuoteBot { public static final String PREFIX = "!"; public static final String NAME = "Movies Quote Bot"; public static final String DESCRIPTION = "I may know quotes from movies."; - public static final String VERSION = "0.4-SNAPSHOT"; + public static final String VERSION = "0.5"; public static final String KILL_SWITCH_FILE = "system_locked"; public static final String MAINTENANCE_MODE_FILE = "maintenance_mode_locked"; private static final Logger logger = LoggerFactory.getLogger(MoviesQuoteBot.class.getCanonicalName()); diff --git a/src/main/java/xyz/vallat/louis/commands/Version.java b/src/main/java/xyz/vallat/louis/commands/Version.java index 292402e..9f3cbb6 100644 --- a/src/main/java/xyz/vallat/louis/commands/Version.java +++ b/src/main/java/xyz/vallat/louis/commands/Version.java @@ -34,10 +34,10 @@ public class Version extends Command { if (guild != null) embedCreateSpec.addField("This guild imported", SubtitleLineManager - .getNumberOfSubtitleLinesByGuild(guild.getId().asString()) + + .getNumberOfSubtitleLinesByGuild(guild.getId().asLong()) + " subtitles lines, from " + SubtitleManager - .getNumberOfSubtitlesByGuild(guild.getId().asString()) + " subtitles.", + .getNumberOfSubtitlesByGuild(guild.getId().asLong()) + " subtitles.", true); } embedCreateSpec.addField("Version", MoviesQuoteBot.VERSION, true) diff --git a/src/main/java/xyz/vallat/louis/database/SubtitleLineManager.java b/src/main/java/xyz/vallat/louis/database/SubtitleLineManager.java index 045e025..4abf55b 100644 --- a/src/main/java/xyz/vallat/louis/database/SubtitleLineManager.java +++ b/src/main/java/xyz/vallat/louis/database/SubtitleLineManager.java @@ -48,14 +48,14 @@ public final class SubtitleLineManager { return -1; } - public static int getNumberOfSubtitleLinesByGuild(String guild_id) { + public static int getNumberOfSubtitleLinesByGuild(long guild_id) { logger.debug("Getting the number of subtitle lines in database from guild '{}'.", guild_id); try (Connection connection = DBManager.getConnection()) { String query = "SELECT COUNT(*) FROM subtitle_lines " + "INNER JOIN subtitles ON subtitles.id = subtitle_lines.subtitle_id " + "WHERE importer_guild_id = ?;"; try (PreparedStatement stmt = connection.prepareStatement(query)) { - stmt.setString(1, guild_id); + stmt.setLong(1, guild_id); stmt.executeQuery(); stmt.getResultSet().next(); return (stmt.getResultSet().getInt(1)); @@ -96,8 +96,8 @@ public final class SubtitleLineManager { try (PreparedStatement stmt = connection.prepareStatement(querySubtitles, PreparedStatement.RETURN_GENERATED_KEYS)) { stmt.setInt(1, movie.getId()); stmt.setInt(2, language.getId()); - stmt.setString(3, importer == null ? null : importer.asString()); - stmt.setString(4, importer_guild == null ? null : importer_guild.asString()); + stmt.setLong(3, importer == null ? null : importer.asLong()); + stmt.setLong(4, importer_guild == null ? null : importer_guild.asLong()); stmt.executeUpdate(); stmt.getGeneratedKeys().next(); subId = stmt.getGeneratedKeys().getInt(1); diff --git a/src/main/java/xyz/vallat/louis/database/SubtitleManager.java b/src/main/java/xyz/vallat/louis/database/SubtitleManager.java index b60eeff..25a9bf9 100644 --- a/src/main/java/xyz/vallat/louis/database/SubtitleManager.java +++ b/src/main/java/xyz/vallat/louis/database/SubtitleManager.java @@ -74,13 +74,13 @@ public final class SubtitleManager { return null; } - public static int getNumberOfSubtitlesByGuild(String guild_id) { + public static int getNumberOfSubtitlesByGuild(long guild_id) { logger.debug("Getting the number of subtitles in database from guild '{}'.", guild_id); try (Connection connection = DBManager.getConnection()) { String query = "SELECT COUNT(*) FROM subtitles " + "WHERE importer_guild_id = ?;"; try (PreparedStatement stmt = connection.prepareStatement(query)) { - stmt.setString(1, guild_id); + stmt.setLong(1, guild_id); stmt.executeQuery(); stmt.getResultSet().next(); return (stmt.getResultSet().getInt(1)); @@ -122,8 +122,8 @@ public final class SubtitleManager { id int GENERATED ALWAYS AS IDENTITY, film_id int NOT NULL, language_id int NOT NULL, - importer_id varchar(37), - importer_guild_id text, + importer_id bigint, + importer_guild_id bigint, imported_date timestamptz NOT NULL DEFAULT now(), UNIQUE (film_id, language_id), PRIMARY KEY (id),