mirror of
https://github.com/Sheldan/OnePlusBot.git
synced 2026-01-02 23:57:14 +00:00
Compare commits
19 Commits
oneplusbot
...
oneplusbot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cc2ed5e96 | ||
|
|
aaf4afe92e | ||
|
|
17e24b14f4 | ||
|
|
ae88377d30 | ||
|
|
4e645885f3 | ||
|
|
77bb7b043b | ||
|
|
9f8d4ebcc8 | ||
|
|
021d07bf47 | ||
|
|
0a7eda239f | ||
|
|
a8587d29af | ||
|
|
e38f5c8382 | ||
|
|
3ab491b5f3 | ||
|
|
ed85b1955f | ||
|
|
f83042c84f | ||
|
|
b11b49e5c4 | ||
|
|
9d1382019f | ||
|
|
6e25ac91cb | ||
|
|
44e3f8656c | ||
|
|
c8a6f67af5 |
2
Tiltfile
2
Tiltfile
@@ -15,7 +15,7 @@ local_resource(
|
||||
deps=['pom.xml'])
|
||||
|
||||
docker_build_with_restart(
|
||||
registry + 'oneplus-bot',
|
||||
registry + 'oneplus-bot-image',
|
||||
'./application/executable/target/jar',
|
||||
entrypoint=['java', '-noverify', '-cp', '.:./lib/*', 'dev.sheldan.oneplus.bot.executable.Application'],
|
||||
dockerfile='./application/executable/Dockerfile',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>executable</artifactId>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
spring.datasource.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}
|
||||
spring.datasource.username= ${DB_USER}
|
||||
spring.datasource.password= ${DB_PASS}
|
||||
spring.datasource.hikari.maximum-pool-size=${hikariPoolSize}
|
||||
spring.jpa.hibernate.default_schema=abstracto
|
||||
spring.jpa.properties.hibernate.default_schema=abstracto
|
||||
spring.quartz.jdbc.initialize-schema=never
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.custom</groupId>
|
||||
<artifactId>oneplus-bot-customizations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</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.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</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.6.7</version>
|
||||
<version>1.6.12</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.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,22 +3,21 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>news</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>dev.sheldan.abstracto.scheduling</groupId>
|
||||
<artifactId>scheduling-int</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -11,6 +11,8 @@ import java.util.List;
|
||||
@Component
|
||||
public class NewsFeature implements FeatureConfig {
|
||||
|
||||
public static final String NEWS_FORUM_POST_NOTIFICATION_SERVER_ID_ENV_NAME = "NEWS_FORUM_POST_NOTIFICATION_SERVER_ID";
|
||||
|
||||
@Override
|
||||
public FeatureDefinition getFeature() {
|
||||
return NewsFeatureDefinition.NEWS;
|
||||
@@ -18,6 +20,6 @@ public class NewsFeature implements FeatureConfig {
|
||||
|
||||
@Override
|
||||
public List<PostTargetEnum> getRequiredPostTargets() {
|
||||
return Arrays.asList(NewsPostTarget.NEWS_TARGET);
|
||||
return Arrays.asList(NewsPostTarget.NEWS_TARGET, NewsPostTarget.FORUM_POST_NOTIFICATION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum NewsPostTarget implements PostTargetEnum {
|
||||
NEWS_TARGET("news");
|
||||
NEWS_TARGET("news"), FORUM_POST_NOTIFICATION("forumPostNotification");
|
||||
|
||||
private String key;
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.job;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.news.service.NewsSourceServiceBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.PersistJobDataAfterExecution;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@DisallowConcurrentExecution
|
||||
@Component
|
||||
@PersistJobDataAfterExecution
|
||||
public class CheckForNewsPosts extends QuartzJobBean {
|
||||
|
||||
@Autowired
|
||||
private NewsSourceServiceBean newsSourceServiceBean;
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
try {
|
||||
log.info("Executing news post check job.");
|
||||
newsSourceServiceBean.checkForNewThreads();
|
||||
} catch (Exception exception) {
|
||||
log.error("Failed to execute news post check job.", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.forum.ForumPost;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class ForumPostNotificationEntry {
|
||||
private Long postId;
|
||||
private String subject;
|
||||
private String content;
|
||||
private Long creatorId;
|
||||
|
||||
public static ForumPostNotificationEntry fromPost(ForumPost forumPost) {
|
||||
return ForumPostNotificationEntry
|
||||
.builder()
|
||||
.postId(forumPost.getId())
|
||||
.subject(forumPost.getSubject())
|
||||
.content(forumPost.getContent())
|
||||
.creatorId(forumPost.getSource().getUserId())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ForumPostNotificationModel {
|
||||
private List<ForumPostNotificationEntry> entries;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.database;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Builder
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "news_forum_post")
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class NewsForumPost {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "creator_id", nullable = false)
|
||||
private NewsSource creator;
|
||||
|
||||
@Column(name = "created")
|
||||
private Instant created;
|
||||
|
||||
@Column(name = "updated")
|
||||
private Instant updated;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.database;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Builder
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "news_source")
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class NewsSource {
|
||||
@Id
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column(name = "thread_count")
|
||||
private Long threadCount;
|
||||
|
||||
@Column(name = "created")
|
||||
private Instant created;
|
||||
|
||||
@Column(name = "updated")
|
||||
private Instant updated;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.forum;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsSource;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ForumPost {
|
||||
private Long id;
|
||||
private String subject;
|
||||
private String content;
|
||||
private NewsSource source;
|
||||
|
||||
public static ForumPost fromRow(NewsForumPostDataRow dataRow, NewsSource newsSource) {
|
||||
return ForumPost
|
||||
.builder()
|
||||
.subject(dataRow.getSubject())
|
||||
.id(dataRow.getId())
|
||||
.content(dataRow.getContent())
|
||||
.source(newsSource)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.forum;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class NewsForumPostData {
|
||||
@SerializedName("rows")
|
||||
private List<NewsForumPostDataRow> rows;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.forum;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class NewsForumPostDataRow {
|
||||
@SerializedName("id")
|
||||
private Long id;
|
||||
|
||||
@SerializedName("subject")
|
||||
private String subject;
|
||||
|
||||
@SerializedName("content")
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.forum;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class NewsForumPostResponse {
|
||||
|
||||
@SerializedName("data")
|
||||
private NewsForumPostData newsForumPostData;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.forum;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class NewsSourceResponse {
|
||||
@SerializedName("data")
|
||||
private NewsSourceUserData user;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.forum;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class NewsSourceUserData {
|
||||
@SerializedName("userStatVO")
|
||||
private NewsSourceUserStats userStats;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.model.forum;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class NewsSourceUserStats {
|
||||
@SerializedName("threadCount")
|
||||
private Long threadCount;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.repository;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsForumPost;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface NewsForumPostRepository extends JpaRepository<NewsForumPost, Long> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.repository;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsSource;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface NewsResourceRepository extends JpaRepository<NewsSource, Long> {
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsSource;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.forum.ForumPost;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.forum.NewsForumPostResponse;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.forum.NewsSourceResponse;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ForumApiClient {
|
||||
|
||||
@Autowired
|
||||
private OkHttpClient okHttpClient;
|
||||
|
||||
@Autowired
|
||||
private Gson gson;
|
||||
|
||||
@Value("${abstracto.feature.news.userURL}")
|
||||
private String userRequestURL;
|
||||
|
||||
@Value("${abstracto.feature.news.threadURL}")
|
||||
private String threadInfoUrl;
|
||||
|
||||
public Long getCurrentThreadCount(NewsSource newsSource) {
|
||||
Request request = new Request.Builder()
|
||||
.url(String.format(userRequestURL, newsSource.getUserId()))
|
||||
.get()
|
||||
.build();
|
||||
Response response;
|
||||
try {
|
||||
response = okHttpClient.newCall(request).execute();
|
||||
if(!response.isSuccessful()) {
|
||||
throw new AbstractoRunTimeException(String.format("Failed to load user info for id %s", newsSource.getUserId()));
|
||||
}
|
||||
NewsSourceResponse newsSourceResponse = gson.fromJson(response.body().string(), NewsSourceResponse.class);
|
||||
if (newsSourceResponse.getUser() != null
|
||||
&& newsSourceResponse.getUser().getUserStats() != null
|
||||
&& newsSourceResponse.getUser().getUserStats().getThreadCount() != null) {
|
||||
return newsSourceResponse.getUser().getUserStats().getThreadCount();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new AbstractoRunTimeException(e);
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public List<ForumPost> getPostsOfSource(NewsSource source) {
|
||||
Request request = new Request.Builder()
|
||||
.url(String.format(threadInfoUrl, source.getUserId()))
|
||||
.get()
|
||||
.build();
|
||||
Response response;
|
||||
try {
|
||||
response = okHttpClient.newCall(request).execute();
|
||||
if(!response.isSuccessful()) {
|
||||
throw new AbstractoRunTimeException(String.format("Failed to load thread info for id %s", source.getUserId()));
|
||||
}
|
||||
NewsForumPostResponse newsSourceResponse = gson.fromJson(response.body().string(), NewsForumPostResponse.class);
|
||||
if (newsSourceResponse.getNewsForumPostData() != null
|
||||
&& newsSourceResponse.getNewsForumPostData().getRows() != null) {
|
||||
return newsSourceResponse
|
||||
.getNewsForumPostData()
|
||||
.getRows()
|
||||
.stream()
|
||||
.map(dataRow -> ForumPost.fromRow(dataRow, source))
|
||||
.toList();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new AbstractoRunTimeException(e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.service;
|
||||
|
||||
import dev.sheldan.abstracto.core.service.PostTargetService;
|
||||
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.oneplus.bot.modules.news.config.NewsPostTarget;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.ForumPostNotificationEntry;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.ForumPostNotificationModel;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsForumPost;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsSource;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.forum.ForumPost;
|
||||
import dev.sheldan.oneplus.bot.modules.news.service.management.NewsForumPostManagementServiceBean;
|
||||
import dev.sheldan.oneplus.bot.modules.news.service.management.NewsSourceManagementServiceBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static dev.sheldan.oneplus.bot.modules.news.config.NewsFeature.NEWS_FORUM_POST_NOTIFICATION_SERVER_ID_ENV_NAME;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NewsSourceServiceBean {
|
||||
|
||||
@Autowired
|
||||
private ForumApiClient forumApiClient;
|
||||
|
||||
@Autowired
|
||||
private NewsSourceManagementServiceBean newsSourceManagementServiceBean;
|
||||
|
||||
@Autowired
|
||||
private NewsForumPostManagementServiceBean newsForumPostManagementServiceBean;
|
||||
|
||||
@Autowired
|
||||
private PostTargetService postTargetService;
|
||||
|
||||
@Autowired
|
||||
private TemplateService templateService;
|
||||
|
||||
@Autowired
|
||||
private NewsSourceServiceBean self;
|
||||
|
||||
private static final String NEWS_FORUM_POST_NOTIFICATION_TEMPLATE_KEY = "newsForumPost_notification";
|
||||
|
||||
public void checkForNewThreads() {
|
||||
Long targetServerId = Long.parseLong(System.getenv(NEWS_FORUM_POST_NOTIFICATION_SERVER_ID_ENV_NAME));
|
||||
List<ForumPost> newForumPosts = getNewForumPosts();
|
||||
log.info("Found {} new forum posts.", newForumPosts.size());
|
||||
if(newForumPosts.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<ForumPostNotificationEntry> entries = new ArrayList<>();
|
||||
newForumPosts.forEach(forumPost -> entries.add(ForumPostNotificationEntry.fromPost(forumPost)));
|
||||
|
||||
ForumPostNotificationModel model = ForumPostNotificationModel
|
||||
.builder()
|
||||
.entries(entries)
|
||||
.build();
|
||||
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(NEWS_FORUM_POST_NOTIFICATION_TEMPLATE_KEY, model, targetServerId);
|
||||
|
||||
FutureUtils.toSingleFutureGeneric(postTargetService.sendEmbedInPostTarget(messageToSend, NewsPostTarget.FORUM_POST_NOTIFICATION, targetServerId))
|
||||
.thenAccept(unused -> {
|
||||
log.info("Sent news forum post notification.");
|
||||
self.persistForumPostsAndThreadCount(entries);
|
||||
}).exceptionally(throwable -> {
|
||||
log.error("Failed to send news forum post notification.", throwable);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void persistForumPostsAndThreadCount(List<ForumPostNotificationEntry> entries) {
|
||||
Map<Long, NewsSource> sourceMap = newsSourceManagementServiceBean.loadNewsSources()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(NewsSource::getUserId, Function.identity()));
|
||||
|
||||
entries.forEach(forumPostNotificationEntry ->
|
||||
newsForumPostManagementServiceBean.createPost(sourceMap.get(forumPostNotificationEntry.getCreatorId()), forumPostNotificationEntry.getPostId()));
|
||||
|
||||
sourceMap.values().forEach(newsSource -> {
|
||||
Long currentThreadCount = forumApiClient.getCurrentThreadCount(newsSource);
|
||||
newsSource.setThreadCount(currentThreadCount);
|
||||
});
|
||||
}
|
||||
|
||||
private boolean hasThreadCountChanged(NewsSource newsSource) {
|
||||
Long currentThreadCount = forumApiClient.getCurrentThreadCount(newsSource);
|
||||
return !currentThreadCount.equals(newsSource.getThreadCount());
|
||||
}
|
||||
|
||||
private List<ForumPost> getNewForumPosts() {
|
||||
List<NewsSource> newsSources = newsSourceManagementServiceBean.loadNewsSources();
|
||||
log.info("Total news source count: {}", newsSources.size());
|
||||
List<NewsSource> sourcesWithChangedThreadCount = newsSources
|
||||
.stream()
|
||||
.filter(this::hasThreadCountChanged)
|
||||
.toList();
|
||||
|
||||
log.info("News sources with new thread count: {}", sourcesWithChangedThreadCount.size());
|
||||
|
||||
List<ForumPost> currentForumPosts = sourcesWithChangedThreadCount
|
||||
.stream()
|
||||
.map(newsSource -> forumApiClient.getPostsOfSource(newsSource))
|
||||
.flatMap(Collection::stream)
|
||||
.toList();
|
||||
|
||||
log.info("Total amount of incoming forum posts: {}", currentForumPosts.size());
|
||||
if(currentForumPosts.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Set<Long> incomingForumPostIds = currentForumPosts
|
||||
.stream()
|
||||
.map(ForumPost::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<NewsForumPost> existingNewsForumPosts = newsForumPostManagementServiceBean.getAllPosts();
|
||||
|
||||
log.info("Total amount of existing and tracked forum posts: {}", existingNewsForumPosts.size());
|
||||
|
||||
Set<Long> existingForumPostIds = existingNewsForumPosts
|
||||
.stream()
|
||||
.map(NewsForumPost::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
incomingForumPostIds.removeAll(existingForumPostIds);
|
||||
|
||||
if(incomingForumPostIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Map<Long, ForumPost> incomingPostMap = currentForumPosts
|
||||
.stream()
|
||||
.collect(Collectors.toMap(ForumPost::getId, Function.identity()));
|
||||
|
||||
return incomingForumPostIds.stream().map(incomingPostMap::get).toList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.service.management;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsForumPost;
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsSource;
|
||||
import dev.sheldan.oneplus.bot.modules.news.repository.NewsForumPostRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class NewsForumPostManagementServiceBean {
|
||||
|
||||
@Autowired
|
||||
private NewsForumPostRepository repository;
|
||||
|
||||
public List<NewsForumPost> getAllPosts() {
|
||||
return repository.findAll();
|
||||
}
|
||||
|
||||
public NewsForumPost createPost(NewsSource creator, Long id) {
|
||||
NewsForumPost post = NewsForumPost
|
||||
.builder()
|
||||
.creator(creator)
|
||||
.id(id)
|
||||
.build();
|
||||
return repository.save(post);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package dev.sheldan.oneplus.bot.modules.news.service.management;
|
||||
|
||||
import dev.sheldan.oneplus.bot.modules.news.model.database.NewsSource;
|
||||
import dev.sheldan.oneplus.bot.modules.news.repository.NewsResourceRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class NewsSourceManagementServiceBean {
|
||||
|
||||
@Autowired
|
||||
private NewsResourceRepository newsResourceRepository;
|
||||
|
||||
public List<NewsSource> loadNewsSources() {
|
||||
return newsResourceRepository.findAll();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,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="news_check_job.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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="check_for_news_job-insert">
|
||||
<insert tableName="scheduler_job">
|
||||
<column name="name" value="checkForNewsJob"/>
|
||||
<column name="group_name" value="news"/>
|
||||
<column name="clazz" value="dev.sheldan.oneplus.bot.modules.news.job.CheckForNewsPosts"/>
|
||||
<column name="active" value="true"/>
|
||||
<column name="cron_expression" value="0 0 0 * * ?"/>
|
||||
<column name="recovery" value="false"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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="news_forum_post-table">
|
||||
<createTable tableName="news_forum_post">
|
||||
<column name="id" type="BIGINT">
|
||||
<constraints nullable="true" primaryKey="true" primaryKeyName="pk_news_forum_post"/>
|
||||
</column>
|
||||
<column name="creator_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="creator_id" baseTableName="news_forum_post" constraintName="fk_news_forum_post_creator"
|
||||
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
|
||||
referencedColumnNames="user_id" referencedTableName="news_source" validate="true"/>
|
||||
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS news_forum_post_update_trigger ON news_forum_post;
|
||||
CREATE TRIGGER repost_check_channel_group_update_trigger BEFORE UPDATE ON news_forum_post FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
|
||||
</sql>
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS news_forum_post_insert_trigger ON news_forum_post;
|
||||
CREATE TRIGGER repost_check_channel_group_insert_trigger BEFORE INSERT ON news_forum_post FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
|
||||
</sql>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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="news_source-table">
|
||||
<createTable tableName="news_source">
|
||||
<column name="user_id" type="BIGINT">
|
||||
<constraints nullable="true" primaryKey="true" primaryKeyName="pk_news_source"/>
|
||||
</column>
|
||||
<column name="thread_count" 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>
|
||||
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS news_source_update_trigger ON news_source;
|
||||
CREATE TRIGGER repost_check_channel_group_update_trigger BEFORE UPDATE ON news_source FOR EACH ROW EXECUTE PROCEDURE update_trigger_procedure();
|
||||
</sql>
|
||||
<sql>
|
||||
DROP TRIGGER IF EXISTS news_source_insert_trigger ON news_source;
|
||||
CREATE TRIGGER repost_check_channel_group_insert_trigger BEFORE INSERT ON news_source FOR EACH ROW EXECUTE PROCEDURE insert_trigger_procedure();
|
||||
</sql>
|
||||
</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="news_source.xml" relativeToChangelogFile="true"/>
|
||||
<include file="news_forum_post.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -8,4 +8,5 @@
|
||||
http://www.liquibase.org/xml/ns/pro dbchangelog.xsd" >
|
||||
<include file="1.3.9-news/collection.xml" relativeToChangelogFile="true"/>
|
||||
<include file="1.3.10-news/collection.xml" relativeToChangelogFile="true"/>
|
||||
<include file="1.6.11/collection.xml" relativeToChangelogFile="true"/>
|
||||
</databaseChangeLog>
|
||||
@@ -1,7 +1,12 @@
|
||||
abstracto.postTargets.news.name=news
|
||||
abstracto.postTargets.forumPostNotification.name=forumPostNotification
|
||||
|
||||
abstracto.featureFlags.news.featureName=news
|
||||
abstracto.featureFlags.news.enabled=false
|
||||
|
||||
abstracto.feature.news.removalDays=4
|
||||
abstracto.feature.news.postLockSeconds=3600
|
||||
|
||||
abstracto.feature.news.userURL=https://community.oneplus.com/ajax/user/frontend/user/info?uid=%s
|
||||
# TODO support pagination.. eventually
|
||||
abstracto.feature.news.threadURL=https://community.oneplus.com/ajax/user/frontend/thread/page?page=1&limit=1000&uid=%s
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.application.modules</groupId>
|
||||
<artifactId>oneplus-bot-modules</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</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.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||
<artifactId>oneplusbot</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
|
||||
<groupId>dev.sheldan.oneplus.bot.application</groupId>
|
||||
<artifactId>application</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
<modules>
|
||||
<module>executable</module>
|
||||
<module>oneplus-bot-customizations</module>
|
||||
|
||||
@@ -15,10 +15,10 @@ type: application
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 1.6.7
|
||||
version: 1.6.12
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "1.6.7"
|
||||
appVersion: "1.6.12"
|
||||
|
||||
@@ -931,7 +931,7 @@
|
||||
"timepicker": {},
|
||||
"timezone": "",
|
||||
"title": "OnePlusBot Discord status",
|
||||
"uid": "a7b3297d-972e-4dbd-9223-88d589817d34",
|
||||
"uid": "8e3188c3-4ea2-4223-865e-d1681f1ef0fb",
|
||||
"version": 2,
|
||||
"weekStart": ""
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"uid": "loki"
|
||||
},
|
||||
"editorMode": "builder",
|
||||
"expr": "{app=\"OnePlusBot\", namespace=\"oneplus-bot\"} |= `$logFilter`",
|
||||
"expr": "{app=\"oneplus-bot\", namespace=\"oneplus-bot\"} |= `$logFilter`",
|
||||
"maxLines": 5000,
|
||||
"queryType": "range",
|
||||
"refId": "A"
|
||||
@@ -92,7 +92,7 @@
|
||||
"uid": "loki"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "{app=\"OnePlusBot\", namespace=\"oneplus-bot\"} |= \"ERROR\"",
|
||||
"expr": "{app=\"oneplus-bot\", namespace=\"oneplus-bot\"} |= \"ERROR\"",
|
||||
"maxLines": 5000,
|
||||
"queryType": "range",
|
||||
"refId": "A"
|
||||
@@ -186,7 +186,7 @@
|
||||
"uid": "loki"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "rate({app=\"OnePlusBot\", namespace=\"oneplus-bot\"}[$__interval])",
|
||||
"expr": "rate({app=\"oneplus-bot\", namespace=\"oneplus-bot\"}[$__interval])",
|
||||
"queryType": "range",
|
||||
"refId": "A"
|
||||
}
|
||||
@@ -230,7 +230,7 @@
|
||||
"timepicker": {},
|
||||
"timezone": "",
|
||||
"title": "OnePlus Bot Logs",
|
||||
"uid": "a5b429af-860c-4438-a575-24bed6dcba09",
|
||||
"uid": "b30e19ce-eb4b-4534-bf51-9fd7da75f606",
|
||||
"version": 2,
|
||||
"weekStart": ""
|
||||
},
|
||||
|
||||
@@ -57,6 +57,8 @@ spec:
|
||||
secretKeyRef:
|
||||
name: db-credentials
|
||||
key: dbName
|
||||
- name: NEWS_FORUM_POST_NOTIFICATION_SERVER_ID
|
||||
value: "{{ .Values.bot.config.newsForumPostNotificationServerId }}"
|
||||
- name: TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
@@ -69,6 +71,10 @@ spec:
|
||||
secretKeyRef:
|
||||
name: api-keys
|
||||
key: youtubeApiKey
|
||||
{{- range $key, $value := .Values.bot.propertyConfig }}
|
||||
- name: {{ $key | quote }}
|
||||
value: {{ $value | quote}}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
|
||||
@@ -7,8 +7,8 @@ replicaCount: 1
|
||||
bot:
|
||||
repository: harbor.sheldan.dev/oneplus-bot
|
||||
pullPolicy: IfNotPresent
|
||||
image: oneplus-bot
|
||||
tag: 1.6.7
|
||||
image: oneplus-bot-image
|
||||
tag: 1.6.12
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 5
|
||||
@@ -17,32 +17,36 @@ bot:
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 5
|
||||
failureThreshold: 3
|
||||
config:
|
||||
newsForumPostNotificationServerId:
|
||||
propertyConfig:
|
||||
hikariPoolSize: 10
|
||||
|
||||
templateDeployment:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/abstracto
|
||||
pullPolicy: Always
|
||||
image: abstracto-template-deployment
|
||||
tag: 1.5.9
|
||||
tag: 1.5.12
|
||||
|
||||
templateDeploymentData:
|
||||
repository: harbor.sheldan.dev/oneplus-bot
|
||||
pullPolicy: Always
|
||||
image: oneplus-bot-template-data
|
||||
tag: 1.6.7
|
||||
tag: 1.6.12
|
||||
|
||||
dbConfigDeployment:
|
||||
enabled: true
|
||||
repository: harbor.sheldan.dev/abstracto
|
||||
pullPolicy: Always
|
||||
image: abstracto-db-deployment
|
||||
tag: 1.5.9
|
||||
tag: 1.5.12
|
||||
|
||||
dbConfigDeploymentData:
|
||||
repository: harbor.sheldan.dev/oneplus-bot
|
||||
pullPolicy: Always
|
||||
image: oneplus-bot-db-data
|
||||
tag: 1.6.7
|
||||
tag: 1.6.12
|
||||
|
||||
dbCredentials:
|
||||
host:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.deployment</groupId>
|
||||
<artifactId>deployment</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
REGISTRY_PREFIX=harbor.sheldan.dev/oneplus-bot/
|
||||
VERSION=1.6.7
|
||||
VERSION=1.6.12
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
bot:
|
||||
build:
|
||||
context: oneplusbot
|
||||
image: ${REGISTRY_PREFIX}oneplus-bot:${VERSION:-latest}
|
||||
image: ${REGISTRY_PREFIX}oneplus-bot-image:${VERSION:-latest}
|
||||
db-data:
|
||||
build:
|
||||
context: db-data
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>oneplusbot</artifactId>
|
||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</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.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<!-- edit in release.yml as well -->
|
||||
<!-- when releasing a new opbot version, update the .env as well-->
|
||||
<abstracto.version>1.5.9</abstracto.version>
|
||||
<abstracto.templates.version>1.4.21</abstracto.templates.version>
|
||||
<abstracto.version>1.5.12</abstracto.version>
|
||||
<abstracto.templates.version>1.4.23</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.6.7</tag>
|
||||
<tag>oneplusbot-1.6.12</tag>
|
||||
</scm>
|
||||
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.customizations</groupId>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||
<artifactId>oneplus-bot-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.customizations</groupId>
|
||||
<artifactId>customization-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||
<artifactId>oneplus-bot-module-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||
<artifactId>oneplus-bot-module-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
<#assign roleMention="<@&479202891358535681>"/>
|
||||
<#assign authorMention>${author.user.name}#${author.user.discriminator}</#assign>
|
||||
<#assign authorMention>${author.user.name}</#assign>
|
||||
"additionalMessage": "<@safe_include "news_post_description"/>",
|
||||
"embeds": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"embeds": [
|
||||
{
|
||||
<#macro postDisplay post>
|
||||
https://community.oneplus.com/thread/${post.postId?c} | ${post.subject?json_string}
|
||||
</#macro>
|
||||
"description": "<#list entries as entry><@postDisplay post=entry /></#list>"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||
<artifactId>oneplus-bot-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.modules</groupId>
|
||||
<artifactId>oneplus-bot-module-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||
<artifactId>templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>oneplus-bot-templates</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
<modules>
|
||||
<module>module-templates</module>
|
||||
<module>customization-templates</module>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>template-overrides</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>template-overrides</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
<#assign user>${member.user.name}#${member.user.discriminator} (${member.asMention}: ${member.id})</#assign>
|
||||
<#assign user>${member.user.name} (${member.asMention}: ${member.id})</#assign>
|
||||
"additionalMessage": "<@safe_include "user_joined_text"/>"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
<#assign user>${user.name}#${user.discriminator} (${user.id})</#assign>
|
||||
<#assign user>${user.name} (${user.id})</#assign>
|
||||
"additionalMessage": "<@safe_include "user_left_text"/>"
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>template-overrides</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>template-overrides</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||
<artifactId>oneplus-bot-templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>template-overrides</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.overrides</groupId>
|
||||
<artifactId>template-overrides</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot</groupId>
|
||||
<artifactId>oneplusbot</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||
<artifactId>templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
</project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
|
||||
<artifactId>customization-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
|
||||
<artifactId>customization-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<artifactId>translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.customizations</groupId>
|
||||
<artifactId>customization-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>module-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>module-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
The channel in which the notifications for new forum posts should be posted to. Currently: ${currentTarget}
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<artifactId>translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>module-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>module-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.modules</groupId>
|
||||
<artifactId>module-translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates</groupId>
|
||||
<artifactId>templates</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations.overrides</groupId>
|
||||
<artifactId>translation-overrides</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>dev.sheldan.oneplus.bot.templates.translations</groupId>
|
||||
<artifactId>translations</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<version>1.6.12</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user