Implemented parsing HTML to remove all HTML tags after parsiong i, u and b
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
a7c4b8c997
commit
5b60e8c243
@ -7,6 +7,7 @@ stages:
|
|||||||
- test
|
- test
|
||||||
- package
|
- package
|
||||||
- release
|
- release
|
||||||
|
- deploy
|
||||||
|
|
||||||
# Disable the Gradle daemon for Continuous Integration servers as correctness
|
# Disable the Gradle daemon for Continuous Integration servers as correctness
|
||||||
# is usually a priority over speed in CI environments. Using a fresh
|
# is usually a priority over speed in CI environments. Using a fresh
|
||||||
@ -58,7 +59,7 @@ package:
|
|||||||
- .gradle
|
- .gradle
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- build/libs/*.jar
|
- build/libs/moviesquotebot.jar
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
@ -75,3 +76,12 @@ release-master:
|
|||||||
- docker push $CONTAINER_RELEASE_IMAGE
|
- docker push $CONTAINER_RELEASE_IMAGE
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
image: alpine
|
||||||
|
before_script:
|
||||||
|
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- chmod 700 ~/.ssh
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ dependencies {
|
|||||||
implementation 'com.github.wtekiela:opensub4j:0.3.0'
|
implementation 'com.github.wtekiela:opensub4j:0.3.0'
|
||||||
implementation 'org.apache.commons:commons-lang3:3.11'
|
implementation 'org.apache.commons:commons-lang3:3.11'
|
||||||
implementation 'commons-cli:commons-cli:1.4'
|
implementation 'commons-cli:commons-cli:1.4'
|
||||||
|
implementation 'org.jsoup:jsoup:1.13.1'
|
||||||
implementation 'org.apache.commons:commons-csv:1.8'
|
implementation 'org.apache.commons:commons-csv:1.8'
|
||||||
implementation 'ch.qos.logback:logback-classic:1.2.3'
|
implementation 'ch.qos.logback:logback-classic:1.2.3'
|
||||||
implementation 'org.postgresql:postgresql:42.2.18.jre7'
|
implementation 'org.postgresql:postgresql:42.2.18.jre7'
|
||||||
|
@ -11,7 +11,7 @@ public class MoviesQuoteBot {
|
|||||||
public static final String PREFIX = "!";
|
public static final String PREFIX = "!";
|
||||||
public static final String NAME = "Movies Quote Bot";
|
public static final String NAME = "Movies Quote Bot";
|
||||||
public static final String DESCRIPTION = "I may know some quotes from some movies.";
|
public static final String DESCRIPTION = "I may know some quotes from some movies.";
|
||||||
public static final String VERSION = "0.3.3-SNAPSHOT";
|
public static final String VERSION = "0.3.4-SNAPSHOT";
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MoviesQuoteBot.class.getCanonicalName());
|
private static final Logger logger = LoggerFactory.getLogger(MoviesQuoteBot.class.getCanonicalName());
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -3,6 +3,8 @@ package xyz.vallat.louis.commands;
|
|||||||
import discord4j.core.event.domain.message.MessageCreateEvent;
|
import discord4j.core.event.domain.message.MessageCreateEvent;
|
||||||
import discord4j.rest.util.Color;
|
import discord4j.rest.util.Color;
|
||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.safety.Whitelist;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@ -49,10 +51,11 @@ public class Quote extends Command {
|
|||||||
if (quote == null)
|
if (quote == null)
|
||||||
embed.setDescription("We don't have any quote in that language right now! Sorry!").setColor(Color.ORANGE);
|
embed.setDescription("We don't have any quote in that language right now! Sorry!").setColor(Color.ORANGE);
|
||||||
else {
|
else {
|
||||||
embed.setDescription(quote.getSubtitleBlock().getDialogue()
|
embed.setDescription(Jsoup.clean(quote.getSubtitleBlock().getDialogue()
|
||||||
.replaceAll("<i>|</i>", "*")
|
.replaceAll("<i>|</i>", "*")
|
||||||
.replaceAll("<b>|</b>", "**")
|
.replaceAll("<b>|</b>", "**")
|
||||||
);
|
.replaceAll("<u>|</u>", "__"),
|
||||||
|
Whitelist.none()));
|
||||||
embed.setFooter(quote.getMovie().toString(), null);
|
embed.setFooter(quote.getMovie().toString(), null);
|
||||||
embed.setColor(Color.MEDIUM_SEA_GREEN);
|
embed.setColor(Color.MEDIUM_SEA_GREEN);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user