added starboard functionality (starboard/starstats)

added module to store/retrieve configuration (double and string values)
replaced a few null values with optionals (emote loading)
fixed creating channels on startup
added delete message/get emote utility to bot service
extended emote service to have utility methods to use emotes
added reactions to message cache
added empty message handling to  post target service, in case the template evaluates to empty
added ability to edit a message in a post target (standard message and embed)
added principle of config listeners, so default config can be created, for example starboard thresholds
added abstract reaction listeners for adding/removing/clearing
fixed foreign keys between channel and server
added emote utils to handle AEmote and Emotes
renamed emotes to be camelCase, so they are easier to type
This commit is contained in:
Sheldan
2020-04-01 14:16:04 +02:00
parent 03e81a025b
commit 089862bf15
72 changed files with 1795 additions and 121 deletions

View File

@@ -8,6 +8,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.ui.freemarker.FreeMarkerConfigurationFactory;
import java.io.IOException;
import java.util.Locale;
@org.springframework.context.annotation.Configuration
public class FreemarkerConfiguration {
@@ -20,6 +21,7 @@ public class FreemarkerConfiguration {
FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
factory.setPreTemplateLoaders(templateLoader);
Configuration configuration = factory.createConfiguration();
configuration.setEncoding(Locale.getDefault(), "utf-8");
// needed to support default methods in interfaces
configuration.setIncompatibleImprovements(Configuration.VERSION_2_3_29);
return configuration;

View File

@@ -98,19 +98,6 @@ public class TemplateServiceBean implements TemplateService {
.build();
}
private String impromptu(String templateStr, Object model) {
try {
Template t = new Template("name", new StringReader(templateStr),
new Configuration(Configuration.VERSION_2_3_29));
return FreeMarkerTemplateUtils.processTemplateIntoString(t, model);
} catch (IOException e) {
e.printStackTrace();
} catch (TemplateException e) {
e.printStackTrace();
}
return "";
}
@Override
public String renderTemplate(String key, HashMap<String, Object> parameters) {
try {