mirror of
https://github.com/Sheldan/OnePlusBot.git
synced 2026-01-02 07:44:18 +00:00
Compare commits
48 Commits
oneplusbot
...
oneplusbot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0c2c24dce | ||
|
|
658683c013 | ||
|
|
8c8cadefdd | ||
|
|
8e9a7004a2 | ||
|
|
29fb53fb7a | ||
|
|
6d23fffc77 | ||
|
|
d816a8a48c | ||
|
|
386011d2e9 | ||
|
|
015609f9d2 | ||
|
|
35a6f0aeeb | ||
|
|
743195b137 | ||
|
|
9f35781f2d | ||
|
|
dbf131abfe | ||
|
|
05dbb1fc2f | ||
|
|
47284686d6 | ||
|
|
46ef5435c7 | ||
|
|
bcfaf1c928 | ||
|
|
124d45ba5b | ||
|
|
4cdaf87412 | ||
|
|
13cf06e1dc | ||
|
|
e8ae0f430d | ||
|
|
cda9d1a2b8 | ||
|
|
653246f3ee | ||
|
|
0879c7cc93 | ||
|
|
4ea878dd42 | ||
|
|
562f5ae9e1 | ||
|
|
92925d176f | ||
|
|
6a5f45c416 | ||
|
|
c7e8fd315f | ||
|
|
95ad8fdd3a | ||
|
|
51775b454e | ||
|
|
aa4de8f571 | ||
|
|
eae07fd07c | ||
|
|
c492640cd7 | ||
|
|
2c49cf2918 | ||
|
|
60ac314ecc | ||
|
|
c82ef9ac18 | ||
|
|
6369ae7c01 | ||
|
|
f9b2174f84 | ||
|
|
d5c8509ab0 | ||
|
|
eaddea63b3 | ||
|
|
7dc141a8a4 | ||
|
|
6652c90edb | ||
|
|
d7f5fc21d6 | ||
|
|
bf98d5db3a | ||
|
|
57fb34920d | ||
|
|
3f959f3bbb | ||
|
|
0380720ec8 |
42
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
42
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Bug Report
|
||||
description: Found a bug that needs fixing?
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: General Troubleshooting
|
||||
description: You confirm to have made the following checks first.
|
||||
options:
|
||||
- label: I have checked for similar issues on the Issue-tracker.
|
||||
required: true
|
||||
- label: I have updated to the latest version
|
||||
required: true
|
||||
- label: I have checked the branches or the maintainers' PRs for upcoming bug fixes.
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Description"
|
||||
description: "General information about the bug"
|
||||
placeholder: "..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Steps to reproduce"
|
||||
description: "What happened when the bug occurred?"
|
||||
placeholder: "1. ..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Expected behaviour"
|
||||
description: "What should happen?"
|
||||
placeholder: "It should..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Actual behaviour"
|
||||
description: "What did happen instead?"
|
||||
placeholder: "It actually ..."
|
||||
validations:
|
||||
required: true
|
||||
36
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
36
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Feature request
|
||||
description: Want some functionality added?
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: General Information
|
||||
description: You confirm to have made the following checks first.
|
||||
options:
|
||||
- label: I have checked for similar issues on the Issue-tracker.
|
||||
required: true
|
||||
- label: I have updated to the latest version
|
||||
required: true
|
||||
- label: I have checked the branches or the maintainers' PRs for upcoming features fixes.
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Description"
|
||||
description: "General description of the feature"
|
||||
placeholder: "..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Feature worth and general use"
|
||||
description: "Why should this exist?"
|
||||
placeholder: "..."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Suggestions for implementation"
|
||||
description: "Any ideas about what the feature should behave/look like? Commands?"
|
||||
placeholder: "It should..."
|
||||
validations:
|
||||
required: false
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -34,5 +34,5 @@ jobs:
|
||||
env:
|
||||
REGISTRY_PREFIX: docker.pkg.github.com/sheldan/oneplusbot/
|
||||
VERSION: ${{ env.version }}
|
||||
ABSTRACTO_VERSION: 1.3.6
|
||||
ABSTRACTO_VERSION: 1.4.20
|
||||
ABSTRACTO_REGISTRY_PREFIX: docker.pkg.github.com/sheldan/abstracto/
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Sheldan
|
||||
Copyright (c) 2022 Sheldan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# r/oneplus Discord bot privacy policy
|
||||
|
||||
Last updated: 04.07.2021
|
||||
Last updated: 06.09.2021
|
||||
|
||||
## Description
|
||||
|
||||
@@ -75,6 +75,7 @@ The detailed list of what information is stored and processed is the following:
|
||||
* this was used for the message used to update the status of a suggestion, but this is currently disabled
|
||||
* the author of the suggestion and the message which has been posted in the suggestions channel
|
||||
* every suggestion will be deleted completely from the database a few days after it has reached a final state (rejected, denied, accepted)
|
||||
* whether you voted for a suggestion and which decision you took
|
||||
|
||||
### Leveling system
|
||||
* the amount of messages which were considered for the leveling system
|
||||
|
||||
14
README.md
14
README.md
@@ -1,11 +1,21 @@
|
||||
# r/oneplus Discord server bot
|
||||
|
||||
This repository contains the rewrite of the [Bot](https://github.com/Rithari/OnePlusBot), which is still in use. The features will be gradually be ported
|
||||
and most of them will be in [abstracto](https://github.com/Sheldan/abstracto), but some of the features need to be customized, as they are r/oneplus specific.
|
||||
This repository contains the rewrite of the [Bot](https://github.com/Rithari/OnePlusBot). It is developed by customizing [abstracto](https://github.com/Sheldan/abstracto), because some features are r/oneplus specific.
|
||||
|
||||
The migration of the existing data from the database is handled via one time migration, and can be found [here](https://github.com/Sheldan/OnePlusBot-migration).
|
||||
|
||||
The FAQ configuration can be found [here](https://github.com/Sheldan/OnePlusBot-faq/).
|
||||
|
||||
Custom features which were ported
|
||||
- [x] FAQ
|
||||
- [x] Setup channel handling
|
||||
- [x] Referral link handling
|
||||
|
||||
# Technologies used in addition to the ones provided in abstracto
|
||||
- [grafana](https://github.com/grafana/grafana) for visualization of the bot status and metrics
|
||||
- [Loki](https://github.com/grafana/loki) to visualize and query log files
|
||||
- [pgAdmin](https://github.com/postgres/pgadmin4) to view the database
|
||||
- [prometheus](https://github.com/prometheus/prometheus) for metric collection
|
||||
- [postgres](https://github.com/postgres/postgres) as a database
|
||||
- [loki](https://github.com/grafana/loki) for log aggregation
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>executable</artifactId>
|
||||
@@ -191,6 +191,12 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>seasonal</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
||||
<artifactId>oneplus-bot-customizations</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>oneplus-bot-customizations</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package dev.sheldan.oneplus.bot.custom.moderation.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import dev.sheldan.abstracto.moderation.config.feature.ModerationFeatureConfig;
|
||||
import dev.sheldan.oneplus.bot.custom.moderation.service.ModModeServiceBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -14,6 +15,8 @@ import java.util.List;
|
||||
@Component
|
||||
public class ModerationCustomFeature implements FeatureConfig {
|
||||
|
||||
public static final String WARN_NOTIFICATION_THRESHOLD = "warnNotificationThreshold";
|
||||
|
||||
@Autowired
|
||||
private ModerationFeatureConfig moderationFeatureConfig;
|
||||
|
||||
@@ -27,9 +30,14 @@ public class ModerationCustomFeature implements FeatureConfig {
|
||||
return Arrays.asList(moderationFeatureConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||
return Arrays.asList(ModerationCustomPostTarget.WARN_THRESHOLD_NOTIFICATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRequiredSystemConfigKeys() {
|
||||
return Arrays.asList(ModModeServiceBean.MODMODE_ROLE_CONFIG_KEY,
|
||||
ModModeServiceBean.MODMODE_CHANGED_ROLE_COLOR_CONFIG_KEY);
|
||||
ModModeServiceBean.MODMODE_CHANGED_ROLE_COLOR_CONFIG_KEY, WARN_NOTIFICATION_THRESHOLD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.oneplus.bot.custom.moderation.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.PostTargetEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ModerationCustomPostTarget implements PostTargetEnum {
|
||||
WARN_THRESHOLD_NOTIFICATION("warnThresholdNotification");
|
||||
|
||||
private String key;
|
||||
|
||||
ModerationCustomPostTarget(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package dev.sheldan.oneplus.bot.custom.moderation.listener;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.listener.DefaultListenerResult;
|
||||
import dev.sheldan.abstracto.core.models.ServerUser;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.core.models.template.display.ChannelDisplay;
|
||||
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
||||
import dev.sheldan.abstracto.core.service.*;
|
||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||
import dev.sheldan.abstracto.core.templating.model.MessageToSend;
|
||||
import dev.sheldan.abstracto.core.templating.service.TemplateService;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.abstracto.moderation.listener.WarningCreatedListener;
|
||||
import dev.sheldan.abstracto.moderation.model.listener.WarningCreatedEventModel;
|
||||
import dev.sheldan.abstracto.moderation.service.management.WarnManagementService;
|
||||
import dev.sheldan.oneplus.bot.custom.moderation.config.ModerationCustomFeature;
|
||||
import dev.sheldan.oneplus.bot.custom.moderation.config.ModerationCustomFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.custom.moderation.config.ModerationCustomPostTarget;
|
||||
import dev.sheldan.oneplus.bot.custom.moderation.model.template.WarningThresholdNotificationModel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class WarningAddedListener implements WarningCreatedListener {
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private WarnManagementService warnManagementService;
|
||||
|
||||
@Autowired
|
||||
private UserInServerManagementService userInServerManagementService;
|
||||
|
||||
@Autowired
|
||||
private ChannelService channelService;
|
||||
|
||||
@Autowired
|
||||
private PostTargetService postTargetService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
public static final String WARN_THRESHOLD_NOTIFICATION_TEMPLATE_KEY = "warning_threshold_notification";
|
||||
|
||||
@Override
|
||||
public DefaultListenerResult execute(WarningCreatedEventModel model) {
|
||||
Long warnNotificationAmount = configService.getLongValueOrConfigDefault(ModerationCustomFeature.WARN_NOTIFICATION_THRESHOLD, model.getServerId());
|
||||
ServerUser warnedUser = ServerUser
|
||||
.builder()
|
||||
.userId(model.getWarnedUserId())
|
||||
.serverId(model.getServerId())
|
||||
.build();
|
||||
AUserInAServer warnedUserInAServer = userInServerManagementService.loadOrCreateUser(warnedUser);
|
||||
List<Long> activeWarnsForUser = warnManagementService.getActiveWarnsForUser(warnedUserInAServer)
|
||||
.stream().map(warning -> warning.getWarnId().getId()).collect(Collectors.toList());
|
||||
Set<Long> warnIds = new HashSet<>(activeWarnsForUser);
|
||||
// we cant be sure we receive the newly persisted warning yet, sadly
|
||||
warnIds.add(model.getWarningId());
|
||||
if(warnIds.size() == warnNotificationAmount) {
|
||||
Long serverId = model.getServerId();
|
||||
|
||||
Long channelId = model.getWarningChannelId();
|
||||
Long warnedUserId = model.getWarnedUserId();
|
||||
GuildMessageChannel channel = channelService.getMessageChannelFromServer(serverId, channelId);
|
||||
WarningThresholdNotificationModel notificationModel = WarningThresholdNotificationModel
|
||||
.builder()
|
||||
.channelDisplay(ChannelDisplay.fromChannel(channel))
|
||||
.memberDisplay(MemberDisplay.fromAUserInAServer(warnedUserInAServer))
|
||||
.messageId(model.getWarningMessageId())
|
||||
.warnCount(warnIds.size())
|
||||
.build();
|
||||
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(WARN_THRESHOLD_NOTIFICATION_TEMPLATE_KEY, notificationModel, serverId);
|
||||
FutureUtils.toSingleFutureGeneric(postTargetService.sendEmbedInPostTarget(messageToSend, ModerationCustomPostTarget.WARN_THRESHOLD_NOTIFICATION, serverId))
|
||||
.thenAccept(unused -> log.info("Warn threshold notification sent for user {} in server {}.", warnedUserId, serverId))
|
||||
.exceptionally(throwable -> {
|
||||
log.error("Failed to sent warn threshold notification for user {} in server {}.", warnedUserId, serverId, throwable);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
return DefaultListenerResult.PROCESSED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return ModerationCustomFeatureDefinition.MODERATION_CUSTOM;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.oneplus.bot.custom.moderation.model.template;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.template.display.ChannelDisplay;
|
||||
import dev.sheldan.abstracto.core.models.template.display.MemberDisplay;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class WarningThresholdNotificationModel {
|
||||
private MemberDisplay memberDisplay;
|
||||
private Integer warnCount;
|
||||
private ChannelDisplay channelDisplay;
|
||||
private Long messageId;
|
||||
}
|
||||
@@ -5,4 +5,9 @@ abstracto.systemConfigs.modModeRoleId.name=modModeRoleId
|
||||
abstracto.systemConfigs.modModeRoleId.longValue=0
|
||||
|
||||
abstracto.systemConfigs.modModeNewRoleColor.name=modModeNewRoleColor
|
||||
abstracto.systemConfigs.modModeNewRoleColor.stringValue=0,0,0
|
||||
abstracto.systemConfigs.modModeNewRoleColor.stringValue=0,0,0
|
||||
|
||||
abstracto.systemConfigs.warnNotificationThreshold.name=warnNotificationThreshold
|
||||
abstracto.systemConfigs.warnNotificationThreshold.longValue=3
|
||||
|
||||
abstracto.postTargets.warnThresholdNotification.name=warnThresholdNotification
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
||||
<artifactId>oneplus-bot-customizations</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ import dev.sheldan.oneplus.bot.modules.faq.config.FAQFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.faq.config.FAQModuleDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.faq.models.command.faq.FAQResponseModel;
|
||||
import dev.sheldan.oneplus.bot.modules.faq.service.FAQResponseServiceBean;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class FAQ extends AbstractConditionableCommand {
|
||||
String commandName;
|
||||
if(!parameters.isEmpty()) {
|
||||
commandName = (String) parameters.get(0);
|
||||
TextChannel channel;
|
||||
GuildMessageChannel channel;
|
||||
if (parameters.size() == 2) {
|
||||
channel = (TextChannel) parameters.get(1);
|
||||
} else {
|
||||
|
||||
@@ -66,6 +66,7 @@ public class ImportFAQ extends AbstractConditionableCommand {
|
||||
AServer server = serverManagementService.loadServer(commandContext.getGuild());
|
||||
List<FaqCommandConfig> commands = faqServiceBean.loadFAQCommandsFromJson(jsonContent);
|
||||
faqServiceBean.createOrUpdateFAQCommands(commands, server);
|
||||
return CompletableFuture.completedFuture(CommandResult.fromSuccess());
|
||||
} else {
|
||||
|
||||
List<String> errors = jsonValidationService.getDetailedException(result.getExceptions())
|
||||
@@ -73,8 +74,8 @@ public class ImportFAQ extends AbstractConditionableCommand {
|
||||
.map(ValidationException::getMessage)
|
||||
.collect(Collectors.toList());
|
||||
channelService.sendTextToChannel(String.join("\n", errors), commandContext.getChannel());
|
||||
return CompletableFuture.completedFuture(CommandResult.fromError("Incorrect faq config."));
|
||||
}
|
||||
return CompletableFuture.completedFuture(CommandResult.fromSuccess());
|
||||
} catch (IOException e) {
|
||||
log.error("IO Exception when loading input file.", e);
|
||||
throw new AbstractoTemplatedException("Failed to load json config.", "failed_to_set_template_exception", e);
|
||||
|
||||
@@ -65,7 +65,8 @@ public class FAQCommandConfigConverter {
|
||||
|
||||
private FaqCommandResponseMessageConfig convertCommandResponse(FAQCommandResponse response, Long botUserId) {
|
||||
FaqCommandResponseEmbedConfig embedConfig = null;
|
||||
if(response.getDescription() != null) {
|
||||
// one of those must not be null, for it to be considered a proper embed
|
||||
if(response.getDescription() != null || response.getImageURL() != null) {
|
||||
boolean useBot = response.getAuthorUserId().equals(botUserId);
|
||||
FaqCommandResponseEmbedColorConfig colorConfig = FaqCommandResponseEmbedColorConfig
|
||||
.builder()
|
||||
|
||||
@@ -22,10 +22,8 @@ import dev.sheldan.oneplus.bot.modules.faq.service.management.FAQChannelGroupCom
|
||||
import dev.sheldan.oneplus.bot.modules.faq.service.management.FAQCommandAliasManagementService;
|
||||
import dev.sheldan.oneplus.bot.modules.faq.service.management.FAQCommandManagementServiceBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.entities.ISnowflake;
|
||||
import net.dv8tion.jda.api.entities.SelfUser;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.*;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -67,7 +65,7 @@ public class FAQResponseServiceBean {
|
||||
@Autowired
|
||||
private FAQResponseServiceBean self;
|
||||
|
||||
public CompletableFuture<FAQResponseModel> loadFAQResponse(String commandName, TextChannel textChannel) {
|
||||
public CompletableFuture<FAQResponseModel> loadFAQResponse(String commandName, GuildMessageChannel textChannel) {
|
||||
AServer server = serverManagementService.loadServer(textChannel.getGuild().getIdLong());
|
||||
Optional<FAQCommand> faqCommandOptional = faqCommandManagementServiceBean.findByNameAndServer(commandName, server);
|
||||
if(!faqCommandOptional.isPresent()) {
|
||||
|
||||
@@ -3,143 +3,124 @@
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 30,
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"faqCommandName": {
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"faqCommandName": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 30,
|
||||
"pattern": "\\w*"
|
||||
},
|
||||
"global": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"aliases": {
|
||||
"type": "array",
|
||||
"minItems": 0,
|
||||
"maxItems": 20,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 30,
|
||||
"pattern": "\\w*"
|
||||
},
|
||||
"global": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"aliases": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 20,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 30,
|
||||
"pattern": "\\w*"
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 255,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channelGroupName": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 20,
|
||||
"pattern": "\\w*"
|
||||
},
|
||||
"messages": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 3,
|
||||
"items": [
|
||||
{
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 255,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"channelGroupName": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 20,
|
||||
"pattern": "\\w*"
|
||||
},
|
||||
"messages": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 3,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"position": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 2
|
||||
},
|
||||
"additionalMessage": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 2000
|
||||
},
|
||||
"embed": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"position": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 2
|
||||
},
|
||||
"additionalMessage": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 2000
|
||||
},
|
||||
"embed": {
|
||||
"imageUrl": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 2000,
|
||||
"pattern": "\\s*https?:\/\/\\S+"
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 2000
|
||||
"red": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"imageUrl": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 2000,
|
||||
"pattern": "\\s*https?:\/\/\\S+"
|
||||
"green": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"red": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"green": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"blue": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0,
|
||||
"maximum": 255
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"red",
|
||||
"green",
|
||||
"blue"
|
||||
]
|
||||
"blue": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0,
|
||||
"maximum": 255
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"red",
|
||||
"green",
|
||||
"blue"
|
||||
]
|
||||
},
|
||||
"author": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"userId": {
|
||||
"minimum": 1,
|
||||
"maximum": 18446744073709551615,
|
||||
"type": "integer"
|
||||
},
|
||||
"author": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"userId": {
|
||||
"minimum": 1,
|
||||
"maximum": 18446744073709551615,
|
||||
"type": "integer"
|
||||
},
|
||||
"useBot": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"anyOf": [
|
||||
{
|
||||
"required": [
|
||||
"userId"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"useBot"
|
||||
]
|
||||
}
|
||||
]
|
||||
"useBot": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"anyOf": [
|
||||
{
|
||||
"required": [
|
||||
"description",
|
||||
"author"
|
||||
"userId"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"imageUrl",
|
||||
"author"
|
||||
"useBot"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -149,41 +130,56 @@
|
||||
"anyOf": [
|
||||
{
|
||||
"required": [
|
||||
"additionalMessage",
|
||||
"position"
|
||||
"description",
|
||||
"author"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"embed",
|
||||
"position"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"additionalMessage",
|
||||
"embed",
|
||||
"position"
|
||||
"imageUrl",
|
||||
"author"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"anyOf": [
|
||||
{
|
||||
"required": [
|
||||
"additionalMessage",
|
||||
"position"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"embed",
|
||||
"position"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"additionalMessage",
|
||||
"embed",
|
||||
"position"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"channelGroupName",
|
||||
"messages"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"channelGroupName",
|
||||
"messages"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"faqCommandName",
|
||||
"responses"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"faqCommandName",
|
||||
"responses"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
||||
<artifactId>scheduling-int</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -12,7 +12,7 @@ import dev.sheldan.oneplus.bot.modules.news.model.database.NewsPost;
|
||||
import dev.sheldan.oneplus.bot.modules.news.service.management.NewsPostManagementServiceBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -113,7 +113,7 @@ public class NewsServiceBean {
|
||||
log.info("Updating news post {} with new content based on message from user {} in server {}.",
|
||||
newsPost.getSourceMessageId(), updatedMessage.getIdLong(), updatedMessage.getGuild().getId());
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(MESSAGE_TEMPLATE_KEY, model, serverId);
|
||||
TextChannel newsChannel = channelService.getTextChannelFromServer(serverId, newsPost.getNewsChannel().getId());
|
||||
GuildMessageChannel newsChannel = channelService.getMessageChannelFromServer(serverId, newsPost.getNewsChannel().getId());
|
||||
return channelService.editMessageInAChannelFuture(messageToSend, newsChannel, newsPost.getNewsMessageId())
|
||||
.thenApply(message -> null);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<module>setup</module>
|
||||
<module>referral</module>
|
||||
<module>faq</module>
|
||||
<module>seasonal</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
39
application/oneplus-bot-modules/seasonal/pom.xml
Normal file
39
application/oneplus-bot-modules/seasonal/pom.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>seasonal</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/liquibase.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,18 @@
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
|
||||
<id>liquibase</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<outputDirectory>.</outputDirectory>
|
||||
<directory>${project.basedir}/src/main/resources/migrations</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
@@ -0,0 +1,24 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.config.ModuleDefinition;
|
||||
import dev.sheldan.abstracto.core.command.config.ModuleInfo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SeasonalEntertainmentFeatureDefinition implements ModuleDefinition {
|
||||
public static final String ENTERTAINMENT = "entertainment";
|
||||
|
||||
@Override
|
||||
public ModuleInfo getInfo() {
|
||||
return ModuleInfo
|
||||
.builder()
|
||||
.name(ENTERTAINMENT)
|
||||
.templated(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParentModule() {
|
||||
return "default";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum SeasonalFeatureDefinition implements FeatureDefinition {
|
||||
LIGHTS("lights");
|
||||
|
||||
private String key;
|
||||
|
||||
SeasonalFeatureDefinition(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:seasonal.properties")
|
||||
public class SeasonalProperties {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.command;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalEntertainmentFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.LightsRoleServiceBean;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class AddRoleToLights extends AbstractConditionableCommand {
|
||||
|
||||
@Autowired
|
||||
private LightsRoleServiceBean lightsMemberServiceBean;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
Role role = (Role) parameters.get(0);
|
||||
if(!role.getGuild().equals(commandContext.getGuild())) {
|
||||
throw new EntityGuildMismatchException();
|
||||
}
|
||||
lightsMemberServiceBean.addMemberToSeasonalLights(role);
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<Parameter> parameters = new ArrayList<>();
|
||||
parameters.add(Parameter.builder().name("role").templated(true).type(Role.class).build());
|
||||
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
|
||||
return CommandConfiguration.builder()
|
||||
.name("addRoleToLights")
|
||||
.module(SeasonalEntertainmentFeatureDefinition.ENTERTAINMENT)
|
||||
.templated(true)
|
||||
.supportsEmbedException(true)
|
||||
.causesReaction(true)
|
||||
.parameters(parameters)
|
||||
.help(helpInfo)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return SeasonalFeatureDefinition.LIGHTS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.command;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.exception.EntityGuildMismatchException;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalEntertainmentFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.LightsRoleServiceBean;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class RemoveRoleFromLights extends AbstractConditionableCommand {
|
||||
|
||||
@Autowired
|
||||
private LightsRoleServiceBean lightsMemberServiceBean;
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandContext commandContext) {
|
||||
List<Object> parameters = commandContext.getParameters().getParameters();
|
||||
Role role = (Role) parameters.get(0);
|
||||
if(!role.getGuild().equals(commandContext.getGuild())) {
|
||||
throw new EntityGuildMismatchException();
|
||||
}
|
||||
lightsMemberServiceBean.removeMemberFromSeasonalLights(role);
|
||||
return CommandResult.fromSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<Parameter> parameters = new ArrayList<>();
|
||||
parameters.add(Parameter.builder().name("role").templated(true).type(Role.class).build());
|
||||
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
|
||||
return CommandConfiguration.builder()
|
||||
.name("removeRoleFromLights")
|
||||
.module(SeasonalEntertainmentFeatureDefinition.ENTERTAINMENT)
|
||||
.templated(true)
|
||||
.supportsEmbedException(true)
|
||||
.causesReaction(true)
|
||||
.parameters(parameters)
|
||||
.help(helpInfo)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return SeasonalFeatureDefinition.LIGHTS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.command;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.condition.AbstractConditionableCommand;
|
||||
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
|
||||
import dev.sheldan.abstracto.core.command.config.HelpInfo;
|
||||
import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalEntertainmentFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.LightsRoleServiceBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component
|
||||
public class SwitchLights extends AbstractConditionableCommand {
|
||||
|
||||
@Autowired
|
||||
private LightsRoleServiceBean lightsMemberServiceBean;
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
return lightsMemberServiceBean.switchLights(commandContext.getGuild())
|
||||
.thenApply(unused -> CommandResult.fromSuccess());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandConfiguration getConfiguration() {
|
||||
List<Parameter> parameters = new ArrayList<>();
|
||||
HelpInfo helpInfo = HelpInfo
|
||||
.builder()
|
||||
.templated(true)
|
||||
.build();
|
||||
return CommandConfiguration.builder()
|
||||
.name("switchLights")
|
||||
.module(SeasonalEntertainmentFeatureDefinition.ENTERTAINMENT)
|
||||
.templated(true)
|
||||
.async(true)
|
||||
.causesReaction(true)
|
||||
.supportsEmbedException(true)
|
||||
.parameters(parameters)
|
||||
.help(helpInfo)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return SeasonalFeatureDefinition.LIGHTS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.config;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.LightsRoleColor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "abstracto.feature.lights")
|
||||
public class LightsColorConfig {
|
||||
private List<LightsRoleColor> colors;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.config;
|
||||
|
||||
import dev.sheldan.abstracto.core.config.FeatureConfig;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.config.SeasonalFeatureDefinition;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class LightsFeatureConfig implements FeatureConfig {
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return SeasonalFeatureDefinition.LIGHTS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.models;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class LightsRoleColor {
|
||||
private Integer r;
|
||||
private Integer g;
|
||||
private Integer b;
|
||||
|
||||
public Color toColor() {
|
||||
return new Color(r, g, b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import lombok.*;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Builder
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "lights_role")
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class LightsRole {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@Getter
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "server_id", nullable = false)
|
||||
private AServer server;
|
||||
|
||||
@Getter
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@PrimaryKeyJoinColumn
|
||||
private ARole role;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.repository;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database.LightsRole;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface LightsRoleRepository extends JpaRepository<LightsRole, Long> {
|
||||
List<LightsRole> findByServer(AServer server);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.service;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.service.RoleService;
|
||||
import dev.sheldan.abstracto.core.service.management.RoleManagementService;
|
||||
import dev.sheldan.abstracto.core.service.management.ServerManagementService;
|
||||
import dev.sheldan.abstracto.core.utils.FutureUtils;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.config.LightsColorConfig;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database.LightsRole;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.service.management.LightsRoleServiceManagementBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.awt.*;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class LightsRoleServiceBean {
|
||||
|
||||
@Autowired
|
||||
private ServerManagementService serverManagementService;
|
||||
|
||||
@Autowired
|
||||
private LightsRoleServiceManagementBean serviceManagementBean;
|
||||
|
||||
@Autowired
|
||||
private RoleManagementService roleManagementService;
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private SecureRandom secureRandom;
|
||||
|
||||
@Autowired
|
||||
private LightsColorConfig lightsColorConfig;
|
||||
|
||||
public void addMemberToSeasonalLights(Role role) {
|
||||
ARole aRole = roleManagementService.findRole(role.getIdLong());
|
||||
log.info("Adding {} to lights for guild {}.", role.getId(), role.getGuild().getId());
|
||||
serviceManagementBean.addMemberToLights(aRole);
|
||||
}
|
||||
|
||||
public void removeMemberFromSeasonalLights(Role role) {
|
||||
ARole aRole = roleManagementService.findRole(role.getIdLong());
|
||||
log.info("Removing {} from lights for guild {}.", role.getId(), role.getGuild().getId());
|
||||
serviceManagementBean.removeMemberFromLights(aRole);
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> switchLights(Guild guild) {
|
||||
log.info("Switching lights in guild {}", guild.getIdLong());
|
||||
AServer server = serverManagementService.loadServer(guild.getIdLong());
|
||||
List<LightsRole> lightUsers = serviceManagementBean.getLightsUserInServer(server);
|
||||
List<Long> roleIds = lightUsers
|
||||
.stream()
|
||||
.map(lightsMember -> lightsMember.getRole().getId())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
||||
roleIds.forEach(roleId -> {
|
||||
Role foundRole = guild.getRoleById(roleId);
|
||||
if(foundRole != null) {
|
||||
futures.add(roleService.setRoleColorTo(foundRole, getRandomColor()));
|
||||
}
|
||||
});
|
||||
return FutureUtils.toSingleFutureGeneric(futures);
|
||||
}
|
||||
|
||||
private Color getRandomColor() {
|
||||
return lightsColorConfig.getColors().get(secureRandom.nextInt(lightsColorConfig.getColors().size())).toColor();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package dev.sheldan.oneplus.bot.modules.seasonal.lights.service.management;
|
||||
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.models.database.LightsRole;
|
||||
import dev.sheldan.oneplus.bot.modules.seasonal.lights.repository.LightsRoleRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class LightsRoleServiceManagementBean {
|
||||
|
||||
@Autowired
|
||||
private LightsRoleRepository lightMemberRepository;
|
||||
|
||||
public void addMemberToLights(ARole aRole) {
|
||||
if(!lightMemberRepository.existsById(aRole.getId())) {
|
||||
LightsRole member = LightsRole
|
||||
.builder()
|
||||
.id(aRole.getId())
|
||||
.server(aRole.getServer())
|
||||
.role(aRole)
|
||||
.build();
|
||||
lightMemberRepository.save(member);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeMemberFromLights(ARole aRole) {
|
||||
lightMemberRepository.deleteById(aRole.getId());
|
||||
}
|
||||
|
||||
public List<LightsRole> getLightsUserInServer(AServer server) {
|
||||
return lightMemberRepository.findByServer(server);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="tables/tables.xml" relativeToChangelogFile="true"/>
|
||||
<include file="seedData/data.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<property name="lightsFeature" value="(SELECT id FROM feature WHERE key = 'lights')"/>
|
||||
<property name="entertainmentModule" value="(SELECT id FROM module WHERE name = 'entertainment')"/>
|
||||
<changeSet author="Sheldan" id="lights-commands" >
|
||||
<insert tableName="command">
|
||||
<column name="name" value="addRoleToLights"/>
|
||||
<column name="module_id" valueComputed="${entertainmentModule}"/>
|
||||
<column name="feature_id" valueComputed="${lightsFeature}"/>
|
||||
</insert>
|
||||
<insert tableName="command">
|
||||
<column name="name" value="removeRoleFromLights"/>
|
||||
<column name="module_id" valueComputed="${entertainmentModule}"/>
|
||||
<column name="feature_id" valueComputed="${lightsFeature}"/>
|
||||
</insert>
|
||||
<insert tableName="command">
|
||||
<column name="name" value="switchLights"/>
|
||||
<column name="module_id" valueComputed="${entertainmentModule}"/>
|
||||
<column name="feature_id" valueComputed="${lightsFeature}"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="feature.xml" relativeToChangelogFile="true"/>
|
||||
<include file="command.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<changeSet author="Sheldan" id="seasonal_lights_feature-insertion">
|
||||
<insert tableName="feature">
|
||||
<column name="key" value="lights"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
|
||||
<changeSet author="Sheldan" id="lights_role-table">
|
||||
<createTable tableName="lights_role">
|
||||
<column name="id" type="BIGINT">
|
||||
<constraints nullable="true" primaryKey="true" primaryKeyName="pk_lights_role"/>
|
||||
</column>
|
||||
<column name="server_id" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="role_id" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseColumnNames="server_id" baseTableName="lights_role" constraintName="fk_lights_role_server"
|
||||
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
referencedColumnNames="id" referencedTableName="server" validate="true"/>
|
||||
<addForeignKeyConstraint baseColumnNames="id" baseTableName="lights_role" constraintName="fk_lights_role_role"
|
||||
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
referencedColumnNames="id" referencedTableName="role" validate="true"/>
|
||||
|
||||
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS lights_role_update_trigger ON lights_role;
|
||||
CREATE TRIGGER lights_role_update_trigger BEFORE UPDATE ON lights_role FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
|
||||
</sql>
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS lights_role_insert_trigger ON lights_role;
|
||||
CREATE TRIGGER lights_role_insert_trigger BEFORE INSERT ON lights_role FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
|
||||
</sql>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="lights_role.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext dbchangelog.xsd
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="1.5.9/collection.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,30 @@
|
||||
abstracto.featureFlags.lights.featureName=lights
|
||||
abstracto.featureFlags.lights.enabled=false
|
||||
|
||||
abstracto.feature.lights.colors[0].r=12
|
||||
abstracto.feature.lights.colors[0].g=169
|
||||
abstracto.feature.lights.colors[0].b=12
|
||||
|
||||
abstracto.feature.lights.colors[1].r=206
|
||||
abstracto.feature.lights.colors[1].g=13
|
||||
abstracto.feature.lights.colors[1].b=13
|
||||
|
||||
abstracto.feature.lights.colors[2].r=255
|
||||
abstracto.feature.lights.colors[2].g=255
|
||||
abstracto.feature.lights.colors[2].b=255
|
||||
|
||||
abstracto.feature.lights.colors[3].r=148
|
||||
abstracto.feature.lights.colors[3].g=125
|
||||
abstracto.feature.lights.colors[3].b=0
|
||||
|
||||
abstracto.feature.lights.colors[4].r=77
|
||||
abstracto.feature.lights.colors[4].g=106
|
||||
abstracto.feature.lights.colors[4].b=255
|
||||
|
||||
abstracto.feature.lights.colors[5].r=166
|
||||
abstracto.feature.lights.colors[5].g=51
|
||||
abstracto.feature.lights.colors[5].b=222
|
||||
|
||||
abstracto.feature.lights.colors[6].r=246
|
||||
abstracto.feature.lights.colors[6].g=232
|
||||
abstracto.feature.lights.colors[6].b=63
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||
<artifactId>oneplusbot</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
<modules>
|
||||
<module>executable</module>
|
||||
<module>oneplus-bot-customizations</module>
|
||||
@@ -38,15 +38,7 @@
|
||||
<artifactId>core-int</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>utility-int</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
||||
<artifactId>scheduling-int</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
|
||||
<artifactId>deployment</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ REST_PASSWORD=password
|
||||
# port grafana will be reachable
|
||||
GRAFANA_PORT=3000
|
||||
# port prometheus will be reachable
|
||||
LOKI_PORT=3100
|
||||
PROMETHEUS_PORT=9090
|
||||
# port pg admin will be reachable
|
||||
PGADMIN_PORT=5050
|
||||
@@ -28,4 +29,4 @@ PGADMIN_DEFAULT_EMAIL=sheldan@sheldan.dev
|
||||
PGADMIN_DEFAULT_PASSWORD=admin
|
||||
TOKEN=<INSERT TOKEN>
|
||||
YOUTUBE_API_KEY=<INSERT KEY>
|
||||
ONEPLUS_BOT_VERSION=1.5.5
|
||||
ONEPLUS_BOT_VERSION=1.6.5
|
||||
@@ -32,7 +32,7 @@ services:
|
||||
EXECUTE_TEMPLATES: ${EXECUTE_TEMPLATES}
|
||||
LIQUIBASE_PATH: ${LIQUIBASE_PATH:-/liquibase}
|
||||
POSTGRES_DRIVER_PATH: ${EXECUTE_DEPLOYMENT:-/postgres/driver.jar}
|
||||
WAIT_HOSTS: database:5432
|
||||
WAIT_HOSTS: ${DATABASE_HOST}:${DATABASE_PORT}
|
||||
networks:
|
||||
- oneplusbot
|
||||
bot:
|
||||
@@ -105,10 +105,34 @@ services:
|
||||
DB_NAME: ${DATABASE_NAME}
|
||||
PROMETHEUS_HOST: 'prometheus'
|
||||
PROMETHEUS_PORT: 9090
|
||||
LOKI_HOST: 'loki'
|
||||
LOKI_PORT: ${LOKI_PORT}
|
||||
volumes:
|
||||
- grafana-user-data:/var/lib/grafana
|
||||
networks:
|
||||
- oneplusbot
|
||||
promtail:
|
||||
container_name: promtail
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_promtail:${ONEPLUS_BOT_VERSION}
|
||||
depends_on:
|
||||
- bot
|
||||
restart: unless-stopped
|
||||
command: -config.file=/mnt/config/promtail-config.yaml
|
||||
volumes:
|
||||
- bot-logs:/logs
|
||||
networks:
|
||||
- oneplusbot
|
||||
loki:
|
||||
container_name: loki
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_loki:${ONEPLUS_BOT_VERSION}
|
||||
depends_on:
|
||||
- promtail
|
||||
command: -config.file=/mnt/config/loki-config.yaml
|
||||
ports:
|
||||
- "127.0.0.1:${LOKI_PORT}:3100"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- oneplusbot
|
||||
|
||||
networks:
|
||||
oneplusbot:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
|
||||
<artifactId>deployment</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -221,8 +221,8 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||
<artifactId>starboard-custom-templates</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.customizations</groupId>
|
||||
<artifactId>starboard-customization-templates</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -372,16 +372,6 @@
|
||||
<destFileName>starboard.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||
<artifactId>utility</artifactId>
|
||||
<version>${abstracto.templates.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||
<destFileName>utility.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto-templates.translations</groupId>
|
||||
<artifactId>webservices</artifactId>
|
||||
@@ -453,8 +443,8 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<artifactId>starboard-custom-translations</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
|
||||
<artifactId>starboard-customization-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -463,8 +453,8 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<artifactId>moderation-custom</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
|
||||
<artifactId>moderation-customization-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -473,7 +463,7 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
|
||||
<artifactId>dynamic-activity-custom-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
@@ -484,7 +474,7 @@
|
||||
|
||||
<!-- custom -->
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>news-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
@@ -494,7 +484,7 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>setup-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
@@ -504,7 +494,7 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>referral-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
@@ -514,7 +504,17 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>seasonal-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/translation-artifacts/</outputDirectory>
|
||||
<destFileName>seasonal.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>faq-translations</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
@@ -590,17 +590,6 @@
|
||||
<destFileName>dynamic-activity.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>utility-impl</artifactId>
|
||||
<version>${abstracto.version}</version>
|
||||
<classifier>liquibase</classifier>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||
<destFileName>utility.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.abstracto.modules</groupId>
|
||||
<artifactId>modmail-impl</artifactId>
|
||||
@@ -834,6 +823,17 @@
|
||||
<destFileName>faq.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>seasonal</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>liquibase</classifier>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${file.basedir}/deployment/liquibase-artifacts/</outputDirectory>
|
||||
<destFileName>seasonal.zip</destFileName>
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>database</artifactId>
|
||||
@@ -848,8 +848,8 @@
|
||||
<!-- overrides -->
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>core-template-overrides</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -858,8 +858,8 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||
<artifactId>webservices</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>webservices-template-overrides</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -868,8 +868,8 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||
<artifactId>logging</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>logging-template-overrides</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -879,8 +879,8 @@
|
||||
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||
<artifactId>statistic</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>statistic-template-overrides</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -889,8 +889,8 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||
<artifactId>modmail</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>modmail-template-overrides</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -899,8 +899,8 @@
|
||||
</artifactItem>
|
||||
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.templates</groupId>
|
||||
<artifactId>moderation</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>moderation-template-overrides</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
@@ -910,8 +910,8 @@
|
||||
|
||||
<!-- overrides translations -->
|
||||
<artifactItem>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides.translations</groupId>
|
||||
<artifactId>moderation</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.overrides</groupId>
|
||||
<artifactId>moderation-translation-overrides</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
|
||||
6
deployment/image-packaging/src/main/docker/.env
Normal file
6
deployment/image-packaging/src/main/docker/.env
Normal file
@@ -0,0 +1,6 @@
|
||||
PROMTAIL_VERSION=2.2.1
|
||||
LOKI_VERSION=2.2.1
|
||||
PROMETHEUS_VERSION=v2.28.1
|
||||
PG_ADMIN_VERSION=5.5
|
||||
GRAFANA_VERSION=8.0.6
|
||||
POSTGRES_VERSION=13.3-buster
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM postgres
|
||||
ARG POSTGRES_VERSION
|
||||
FROM postgres:${POSTGRES_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
VOLUME /tmp
|
||||
ADD sql/init.sql /docker-entrypoint-initdb.d/init.sql
|
||||
@@ -11,7 +11,7 @@
|
||||
"voice-channel-context", "anti-raid",
|
||||
"starboard-custom", "dynamic-activity-custom-translations", "moderation-custom",
|
||||
"overrides-translation-moderation",
|
||||
"news", "setup", "referral", "faq"],
|
||||
"news", "setup", "referral", "faq", "seasonal"],
|
||||
"liquibase_artifacts": [
|
||||
{ "zip": "scheduling", "file": "scheduling-changeLog.xml" },
|
||||
{ "zip": "core", "file": "core-changeLog.xml" },
|
||||
@@ -40,7 +40,8 @@
|
||||
{ "zip": "moderation-custom", "file": "moderation-custom-changeLog.xml"},
|
||||
{ "zip": "dynamic-activity-custom", "file": "dynamicActivity-custom-changeLog.xml"},
|
||||
{ "zip": "news", "file": "news-changeLog.xml"},
|
||||
{ "zip": "faq", "file": "faq-changeLog.xml"}
|
||||
{ "zip": "faq", "file": "faq-changeLog.xml"},
|
||||
{ "zip": "seasonal", "file": "seasonal-changeLog.xml"}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,20 @@ version: "3.7"
|
||||
|
||||
services:
|
||||
bot:
|
||||
build: oneplusbot
|
||||
build:
|
||||
context: oneplusbot
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot:${VERSION:-latest}
|
||||
database:
|
||||
build: database
|
||||
build:
|
||||
context: database
|
||||
args:
|
||||
POSTGRES_VERSION: ${POSTGRES_VERSION}
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_database:${VERSION:-latest}
|
||||
pg_admin:
|
||||
build: pgAdmin
|
||||
build:
|
||||
context: pgAdmin
|
||||
args:
|
||||
PG_ADMIN_VERSION: ${PG_ADMIN_VERSION}
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_pg_admin:${VERSION:-latest}
|
||||
deployment_container:
|
||||
build:
|
||||
@@ -18,8 +25,26 @@ services:
|
||||
ABSTRACTO_VERSION: ${ABSTRACTO_VERSION}
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_deployment:${VERSION:-latest}
|
||||
prometheus:
|
||||
build: prometheus
|
||||
build:
|
||||
context: prometheus
|
||||
args:
|
||||
PROMETHEUS_VERSION: ${PROMETHEUS_VERSION}
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_prometheus:${VERSION:-latest}
|
||||
grafana:
|
||||
build: grafana
|
||||
build:
|
||||
context: grafana
|
||||
args:
|
||||
GRAFANA_VERSION: ${GRAFANA_VERSION}
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_grafana:${VERSION:-latest}
|
||||
promtail:
|
||||
build:
|
||||
context: promtail
|
||||
args:
|
||||
PROMTAIL_VERSION: ${PROMTAIL_VERSION}
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_promtail:${VERSION:-latest}
|
||||
loki:
|
||||
build:
|
||||
context: loki
|
||||
args:
|
||||
LOKI_VERSION: ${LOKI_VERSION}
|
||||
image: ${REGISTRY_PREFIX}oneplus_bot_loki:${VERSION:-latest}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM grafana/grafana
|
||||
ARG GRAFANA_VERSION
|
||||
FROM grafana/grafana:${GRAFANA_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD ./provisioning /etc/grafana/provisioning
|
||||
ADD ./config.ini /etc/grafana/config.ini
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": "-- Grafana --",
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"gnetId": null,
|
||||
"graphTooltip": 0,
|
||||
"id": 4,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"datasource": "Loki",
|
||||
"gridPos": {
|
||||
"h": 14,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"dedupStrategy": "none",
|
||||
"enableLogDetails": true,
|
||||
"showLabels": false,
|
||||
"showTime": false,
|
||||
"sortOrder": "Descending",
|
||||
"wrapLogMessage": true
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"expr": "{job=\"oneplus-bot-logs\", filename=\"/logs/log.log\"}",
|
||||
"queryType": "randomWalk",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "OnePlus Bot logs",
|
||||
"type": "logs"
|
||||
}
|
||||
],
|
||||
"refresh": "",
|
||||
"schemaVersion": 30,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"time": {
|
||||
"from": "now-3h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "",
|
||||
"title": "OnePlus Bot logs",
|
||||
"uid": "1uGb0q4nz",
|
||||
"version": 2
|
||||
}
|
||||
@@ -20,4 +20,10 @@ datasources:
|
||||
jsonData:
|
||||
sslmode: 'disable'
|
||||
version: 1
|
||||
editable: false
|
||||
editable: false
|
||||
- name: Loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: 'http://${LOKI_HOST}:${LOKI_PORT}'
|
||||
jsonData:
|
||||
maxLines: 2000
|
||||
@@ -0,0 +1,4 @@
|
||||
ARG LOKI_VERSION
|
||||
FROM grafana/loki:${LOKI_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD loki.yml /mnt/config/loki-config.yaml
|
||||
66
deployment/image-packaging/src/main/docker/loki/loki.yml
Normal file
66
deployment/image-packaging/src/main/docker/loki/loki.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
auth_enabled: false
|
||||
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
grpc_listen_port: 9096
|
||||
|
||||
ingester:
|
||||
wal:
|
||||
enabled: true
|
||||
dir: /tmp/wal
|
||||
lifecycler:
|
||||
address: 127.0.0.1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
replication_factor: 1
|
||||
final_sleep: 0s
|
||||
chunk_idle_period: 1h
|
||||
max_chunk_age: 1h
|
||||
chunk_target_size: 1048576
|
||||
chunk_retain_period: 30s
|
||||
max_transfer_retries: 0
|
||||
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2020-10-24
|
||||
store: boltdb-shipper
|
||||
object_store: filesystem
|
||||
schema: v11
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
storage_config:
|
||||
boltdb_shipper:
|
||||
active_index_directory: /tmp/loki/boltdb-shipper-active
|
||||
cache_location: /tmp/loki/boltdb-shipper-cache
|
||||
cache_ttl: 24h
|
||||
shared_store: filesystem
|
||||
filesystem:
|
||||
directory: /tmp/loki/chunks
|
||||
|
||||
compactor:
|
||||
working_directory: /tmp/loki/boltdb-shipper-compactor
|
||||
shared_store: filesystem
|
||||
|
||||
limits_config:
|
||||
reject_old_samples: true
|
||||
reject_old_samples_max_age: 168h
|
||||
|
||||
chunk_store_config:
|
||||
max_look_back_period: 0s
|
||||
|
||||
table_manager:
|
||||
retention_deletes_enabled: true
|
||||
retention_period: 360h
|
||||
|
||||
ruler:
|
||||
storage:
|
||||
type: local
|
||||
local:
|
||||
directory: /tmp/loki/rules
|
||||
rule_path: /tmp/loki/rules-temp
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM dpage/pgadmin4
|
||||
ARG PG_ADMIN_VERSION
|
||||
FROM dpage/pgadmin4:${PG_ADMIN_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
VOLUME /tmp
|
||||
ADD config/servers.json /pgadmin4/servers.json
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM prom/prometheus
|
||||
ARG PROMETHEUS_VERSION
|
||||
FROM prom/prometheus:${PROMETHEUS_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD prometheus.yml /etc/prometheus/prometheus.yml
|
||||
@@ -0,0 +1,4 @@
|
||||
ARG PROMTAIL_VERSION
|
||||
FROM grafana/promtail:${PROMTAIL_VERSION}
|
||||
MAINTAINER Sheldan
|
||||
ADD promtail.yaml /mnt/config/promtail-config.yaml
|
||||
@@ -0,0 +1,17 @@
|
||||
server:
|
||||
disable: true
|
||||
|
||||
positions:
|
||||
filename: /tmp/positions.yaml
|
||||
|
||||
clients:
|
||||
- url: http://loki:3100/loki/api/v1/push
|
||||
|
||||
scrape_configs:
|
||||
- job_name: system
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost
|
||||
labels:
|
||||
job: oneplus-bot-logs
|
||||
__path__: /logs/*.log
|
||||
29
deployment/infrastructure/terraform/.gitignore
vendored
Normal file
29
deployment/infrastructure/terraform/.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# Local .terraform directories
|
||||
**/.terraform/*
|
||||
|
||||
# .tfstate files
|
||||
*.tfstate
|
||||
*.tfstate.*
|
||||
|
||||
# Crash log files
|
||||
crash.log
|
||||
|
||||
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
|
||||
# .tfvars files are managed as part of configuration and so should be included in
|
||||
# version control.
|
||||
#
|
||||
# example.tfvars
|
||||
|
||||
# Ignore override files as they are usually used to override resources locally and so
|
||||
# are not checked in
|
||||
override.tf
|
||||
override.tf.json
|
||||
*_override.tf
|
||||
*_override.tf.json
|
||||
|
||||
# Include override files you do wish to add to version control using negated pattern
|
||||
#
|
||||
# !example_override.tf
|
||||
|
||||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
|
||||
# example: *tfplan*
|
||||
23
deployment/infrastructure/terraform/.terraform.lock.hcl
generated
Normal file
23
deployment/infrastructure/terraform/.terraform.lock.hcl
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/hetznercloud/hcloud" {
|
||||
version = "1.34.3"
|
||||
hashes = [
|
||||
"h1:ZAFEiotL15xHI957CrTJEm3z83/lFMQdNWiMqN7Dyu4=",
|
||||
"zh:08e4aea3c4e895d941c24d76f373977e5fae112c531b56cb2fcdaa8b5086ebec",
|
||||
"zh:09f1255aad8f790c86a14522c7fff2fcb6529bb18f1e49a7423ca79db07f5a47",
|
||||
"zh:0b2bcab12aa913adaf89228a250eb41e827c64723a741f2b74b318833f77c9df",
|
||||
"zh:0c6947f73dc5779b2425e231b22643741b1877705fb4135df06f7a201f10d094",
|
||||
"zh:26513bdefecae83411997a5c4e11dffd886b4594cb8663f4b0c36a064b1a650e",
|
||||
"zh:42790576142fb7d0ce851923f58a642e7e4c9e6df9a02b531703131d836daade",
|
||||
"zh:5095ea6c8b31dfebd52a03f9ba4e2a8a7ecb0c0442f68c98cab76b677c343e81",
|
||||
"zh:6b80223b2831f9f2adf72c7ed37692cef67c8f43de62c405c7162bf524896bc3",
|
||||
"zh:6b90164e839ad0977b3feb4dbec153ab76a4f7ee8451ee2d202992ff5a4157b1",
|
||||
"zh:72d88705afb9d0a9d90a5ad342c605cb119b678e76f45c5e4c516da5d591f907",
|
||||
"zh:881889a9e974a15c616cd7648f1c415a4fb3e9a08c166bcb17e488bfcbb67985",
|
||||
"zh:967286f7ef73bb15c2412b9ae8853d1176a039374c5ea39cbfd75e7ebe13bcfd",
|
||||
"zh:967a6cc506a019c1720f0207068097a06eb006e940ecc63060373b4b4b6181cc",
|
||||
"zh:a68e5e2e2f03656e427045e32ca999422e00be299fc6ecedbd41bef48871b7c5",
|
||||
]
|
||||
}
|
||||
10
deployment/infrastructure/terraform/cloud.tf
Normal file
10
deployment/infrastructure/terraform/cloud.tf
Normal file
@@ -0,0 +1,10 @@
|
||||
terraform {
|
||||
cloud {
|
||||
hostname = "app.terraform.io"
|
||||
organization = "OnePlusBot"
|
||||
|
||||
workspaces {
|
||||
name = "main"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
deployment/infrastructure/terraform/main.tf
Normal file
7
deployment/infrastructure/terraform/main.tf
Normal file
@@ -0,0 +1,7 @@
|
||||
module "hetzner" {
|
||||
source = "git@github.com:Sheldan/discord-bot-terraform-module.git//hetzner-bot?ref=v1.0.1"
|
||||
ssh_key_key = "Sheldan"
|
||||
project_name = "OnePlusBot"
|
||||
user_name = "sheldan"
|
||||
hcloud_token = var.hcloud_token
|
||||
}
|
||||
4
deployment/infrastructure/terraform/output.tf
Normal file
4
deployment/infrastructure/terraform/output.tf
Normal file
@@ -0,0 +1,4 @@
|
||||
output "instance_ipv4" {
|
||||
description = "IPv4 address of the instance"
|
||||
value = module.hetzner.instance_ipv4
|
||||
}
|
||||
3
deployment/infrastructure/terraform/variables.tf
Normal file
3
deployment/infrastructure/terraform/variables.tf
Normal file
@@ -0,0 +1,3 @@
|
||||
variable "hcloud_token" {
|
||||
type = string
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>oneplusbot</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
8
pom.xml
8
pom.xml
@@ -12,15 +12,15 @@
|
||||
|
||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||
<artifactId>oneplusbot</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<version>1.6.5</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<!-- edit in release.yml as well -->
|
||||
<!-- when releasing a new opbot version, update the .env as well-->
|
||||
<abstracto.version>1.3.6</abstracto.version>
|
||||
<abstracto.templates.version>1.2.18</abstracto.templates.version>
|
||||
<abstracto.version>1.4.20</abstracto.version>
|
||||
<abstracto.templates.version>1.4.13</abstracto.templates.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
@@ -56,7 +56,7 @@
|
||||
<scm>
|
||||
<url>https://maven.pkg.github.com/Sheldan/OnePlusBot</url>
|
||||
<developerConnection>scm:git:git@github.com:Sheldan/OnePlusBot.git</developerConnection>
|
||||
<tag>oneplusbot-1.5.5</tag>
|
||||
<tag>oneplusbot-1.6.5</tag>
|
||||
</scm>
|
||||
|
||||
</project>
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
<#if additionalMessage??>
|
||||
"additionalMessage": "${additionalMessage?json_string}"
|
||||
</#if>
|
||||
<#if description?? || imageURL??>
|
||||
<#include "user_author">
|
||||
<#if additionalMessage??>,</#if>
|
||||
<@user_author user=author/>
|
||||
<#if description??>
|
||||
,"description": "${description?json_string}"
|
||||
</#if>
|
||||
,"color" : {
|
||||
"r": "${red}",
|
||||
"g": "${green}",
|
||||
"b": "${blue}"
|
||||
}
|
||||
<#if imageURL??>
|
||||
,"imageUrl": "${imageURL}"
|
||||
</#if>
|
||||
</#if>
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
<#assign roleMention="<@&479202891358535681>"/>
|
||||
<#assign authorMention>${author.user.name}#${author.user.discriminator}</#assign>
|
||||
"additionalMessage": "<@safe_include "news_post_description"/>",
|
||||
<#if message.attachments?size gt 0>
|
||||
"imageUrl": "${message.attachments[0].proxyUrl}",
|
||||
</#if>
|
||||
"metaConfig": {
|
||||
"allowsRoleMention": true,
|
||||
"preventEmptyEmbed": true
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
<#include "abstracto_color">,
|
||||
<#include "member_author">
|
||||
<#assign member=postingMember>
|
||||
<@member_author member=member/>,
|
||||
<#include "full_member_info">
|
||||
"description": "<@safe_include "referralListener_referral_post_description"/>",
|
||||
"fields": [
|
||||
<#list referrals as referral><#assign referral=referral>
|
||||
{
|
||||
"name": "<@safe_include "referral_link_type_${referral.type.key}"/>",
|
||||
"value": "[${referral.referralIdentifier?json_string}](${referral.referralLink?json_string})"
|
||||
}
|
||||
<#sep>,
|
||||
</#list>
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
<#include "abstracto_color">,
|
||||
"description": "<@safe_include "too_recent_referral_post"/>",
|
||||
"timeStamp": "${nextReferralDate}"
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"title": {
|
||||
"title": "<@safe_include "starboard_post_created_title"/>"
|
||||
},
|
||||
<#include "abstracto_color">,
|
||||
"description": "<@safe_include "starboard_post_created_description"/>",
|
||||
"fields": [
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starboard_message"/>",
|
||||
<#if starboardMessage??>
|
||||
"value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starboardMessage.jumpUrl})"
|
||||
<#else>
|
||||
"value": "${post.starboardMessageId?c}"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_message"/>",
|
||||
<#if starredMessage??>
|
||||
"value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starredMessage.jumpUrl})"
|
||||
<#else>
|
||||
"value": "${post.postMessageId?c}"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_user"/>",
|
||||
<#if starredMember??>
|
||||
"value": "${starredMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starredUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starring_user"/>",
|
||||
<#if starringMember??>
|
||||
"value": "${starringMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starringUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"title": {
|
||||
"title": "<@safe_include "starboard_post_deleted_title"/>"
|
||||
},
|
||||
<#include "abstracto_color">,
|
||||
"description": "<@safe_include "starboard_post_deleted_description"/>",
|
||||
"fields": [
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_message"/>",
|
||||
<#if starredMessage??>
|
||||
"value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starredMessage.jumpUrl})"
|
||||
<#else>
|
||||
"value": "${starredMessageSimple.jumpUrl}"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_user"/>",
|
||||
<#if starredMember??>
|
||||
"value": "${starredMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starredUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starring_user"/>",
|
||||
<#if starringMember??>
|
||||
"value": "${starringMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starringUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.customizations</groupId>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>moderation-customization-templates</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"embeds": [
|
||||
{
|
||||
"title": {
|
||||
"title": "<@safe_include "warning_threshold_reached_notification_title"/>"
|
||||
},
|
||||
<#include "abstracto_color">,
|
||||
<#assign warnedMemberMention=memberDisplay.memberMention>
|
||||
<#assign warnedUserId=memberDisplay.userId>
|
||||
<#assign memberMention=memberDisplay.memberMention>
|
||||
<#assign warnCount=warnCount>
|
||||
<#assign channelDisplay=channelDisplay>
|
||||
<#assign messageId=messageId>
|
||||
"description": "<@safe_include "warning_threshold_reached_notification_description"/>"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||
<artifactId>oneplus-bot-templates</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.customizations</groupId>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>starboard-customization-templates</module>
|
||||
<module>moderation-customization-templates</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||
<artifactId>oneplus-bot-modules-templates</artifactId>
|
||||
<version>1.5.5</version>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.customizations</groupId>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>starboard-custom-templates</artifactId>
|
||||
<artifactId>starboard-customization-templates</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<build>
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"embeds": [
|
||||
{
|
||||
"title": {
|
||||
"title": "<@safe_include "starboard_post_created_title"/>"
|
||||
},
|
||||
<#include "abstracto_color">,
|
||||
"description": "<@safe_include "starboard_post_created_description"/>",
|
||||
"fields": [
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starboard_message"/>",
|
||||
<#if starboardMessage??>
|
||||
"value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starboardMessage.jumpUrl})"
|
||||
<#else>
|
||||
"value": "${post.starboardMessageId?c}"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_message"/>",
|
||||
<#if starredMessage??>
|
||||
"value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starredMessage.jumpUrl})"
|
||||
<#else>
|
||||
"value": "${post.postMessageId?c}"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_user"/>",
|
||||
<#if starredMember??>
|
||||
"value": "${starredMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starredUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starring_user"/>",
|
||||
<#if starringMember??>
|
||||
"value": "${starringMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starringUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"embeds": [
|
||||
{
|
||||
"title": {
|
||||
"title": "<@safe_include "starboard_post_deleted_title"/>"
|
||||
},
|
||||
<#include "abstracto_color">,
|
||||
"description": "<@safe_include "starboard_post_deleted_description"/>",
|
||||
"fields": [
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_message"/>",
|
||||
<#if starredMessage??>
|
||||
"value": "[<@safe_include "starboard_post_notification_field_starboard_message_jump"/>](${starredMessage.jumpUrl})"
|
||||
<#else>
|
||||
"value": "${starredMessageSimple.jumpUrl}"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starred_user"/>",
|
||||
<#if starredMember??>
|
||||
"value": "${starredMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starredUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
},
|
||||
{
|
||||
"name": "<@safe_include "starboard_post_notification_field_starring_user"/>",
|
||||
<#if starringMember??>
|
||||
"value": "${starringMember.asMention}"
|
||||
<#else>
|
||||
"value": "${starringUserId?c} (<@safe_include "user_left_server"/>)"
|
||||
</#if>
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,19 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>oneplus-bot-modules-templates</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||
<version>1.5.5</version>
|
||||
<artifactId>oneplus-bot-module-templates</artifactId>
|
||||
<version>1.6.5</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>faq-templates</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
<#include "abstracto_color">,
|
||||
"description": "
|
||||
"embeds": [
|
||||
{
|
||||
<#include "abstracto_color">,
|
||||
"description": "
|
||||
<#list uses as usage>
|
||||
<#assign usage=usage>
|
||||
<#assign commandName=usage.faqCommandName><@safe_include "FAQUsage_command_display"/>:
|
||||
@@ -11,4 +13,6 @@
|
||||
<@safe_include "FAQUsage_usage_display"/><#sep>, </#list>
|
||||
<#else>
|
||||
<@safe_include "FAQUsage_no_usages"/></#list>"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
<#if additionalMessage??>
|
||||
"additionalMessage": "${additionalMessage?json_string}"
|
||||
</#if>
|
||||
"embeds": [
|
||||
{
|
||||
<#if description?? || imageURL??>
|
||||
<#include "user_author">
|
||||
<#if additionalMessage??>,</#if>
|
||||
<@user_author user=author/>
|
||||
<#if description??>
|
||||
,"description": "${description?json_string}"
|
||||
</#if>
|
||||
,"color" : {
|
||||
"r": "${red}",
|
||||
"g": "${green}",
|
||||
"b": "${blue}"
|
||||
}
|
||||
<#if imageURL??>
|
||||
,"imageUrl": "${imageURL}"
|
||||
</#if>
|
||||
</#if>
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
<#include "abstracto_color">,
|
||||
"description": "
|
||||
<@safe_include "listFAQCommands_command_header"/>
|
||||
"embeds": [
|
||||
{
|
||||
<#include "abstracto_color">,
|
||||
"description": "
|
||||
<@safe_include "listFAQCommands_command_header"/>
|
||||
|
||||
<#list commands as command>
|
||||
<#assign command=command>
|
||||
@@ -17,4 +19,6 @@
|
||||
|
||||
<#else>
|
||||
<@safe_include "listFAQCommands_no_commands"/></#list>"
|
||||
}
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user