Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"features": {
"ghcr.io/devcontainers/features/java:1": {
"version": "24-tem",
"version": "25-tem",
"jdkDistro": "tem",
"installGradle": true
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/basic-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Basic checks
on: [pull_request]

env:
JAVA_VERSION: 24
JAVA_VERSION: 25

jobs:
spotless:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- cron: '0 20 * * 4'

env:
JAVA_VERSION: 24
JAVA_VERSION: 25

jobs:
sonar:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'master'

env:
JAVA_VERSION: 24
JAVA_VERSION: 25

jobs:
docker:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docker Verify
on: [pull_request]

env:
JAVA_VERSION: 24
JAVA_VERSION: 25

jobs:
docker:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defaults:
shell: bash

env:
JAVA_VERSION: 24
JAVA_VERSION: 25

jobs:

Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
//Configure the JDK to Java 18 in settings
//Configure the JDK to Java 25 in settings
"java.compile.nullAnalysis.mode": "disabled",
"java.format.settings.url": "meta/formatting/google-style-eclipse.xml",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"java.format.enabled": true,
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TJ-Bot

[![codefactor](https://img.shields.io/codefactor/grade/github/together-java/tj-bot)](https://www.codefactor.io/repository/github/together-java/tj-bot)
![Java](https://img.shields.io/badge/Java-24-ff696c)
![Java](https://img.shields.io/badge/Java-25-ff696c)
[![license](https://img.shields.io/github/license/Together-Java/TJ-Bot)](https://github.com/Together-Java/TJ-Bot/blob/master/LICENSE)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/Together-Java/TJ-Bot?label=release)

Expand Down
12 changes: 6 additions & 6 deletions application/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
buildscript {
dependencies {
classpath 'org.xerial:sqlite-jdbc:3.50.1.0'
classpath 'org.xerial:sqlite-jdbc:3.51.0.0'
}
}

plugins {
id 'application'
id 'com.google.cloud.tools.jib' version '3.4.5'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.google.cloud.tools.jib' version '3.5.0'
id 'com.gradleup.shadow' version '9.2.2'
id 'database-settings'
}

Expand All @@ -18,7 +18,7 @@ repositories {
var outputImage = 'togetherjava.org:5001/togetherjava/tjbot:' + System.getenv('BRANCH_NAME') ?: 'latest'

jib {
from.image = 'eclipse-temurin:24'
from.image = 'eclipse-temurin:25'
to {
image = outputImage
auth {
Expand Down Expand Up @@ -78,9 +78,9 @@ dependencies {
implementation 'org.kohsuke:github-api:1.329'

implementation 'org.apache.commons:commons-text:1.14.0'
implementation 'com.apptasticsoftware:rssreader:3.10.0'
implementation 'com.apptasticsoftware:rssreader:3.11.0'

testImplementation 'org.mockito:mockito-core:5.19.0'
testImplementation 'org.mockito:mockito-core:5.20.0'
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
Expand Down
10 changes: 7 additions & 3 deletions application/config.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
"whatsapp",
"crypto",
"^claim",
"teen",
"^teen$",
"adobe",
"hack",
"^hack$",
"hacks",
"steamcommunity",
"freenitro",
"^earn$",
Expand All @@ -62,7 +63,10 @@
"youtube.com",
"www.youtube.com",
"cdn.discordapp.com",
"media.discordapp.net"
"media.discordapp.net",
"store.steampowered.com",
"help.steampowered.com",
"learn.microsoft.com"
],
"hostBlacklist": [
"bit.ly",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ public void onMessageContext(MessageContextInteractionEvent event) {
.formatted(originalMessage);
Optional<String> chatGptTitle = chatGptService.ask(chatGptTitleRequest, null);
String title = chatGptTitle.orElse(createTitle(originalMessage));
if (title.startsWith("\"") && title.endsWith("\"")) {
title = title.substring(1, title.length() - 1);
}

if (title.length() > TITLE_MAX_LENGTH) {
title = title.substring(0, TITLE_MAX_LENGTH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import java.net.URI;
import java.util.Locale;
import java.util.function.Predicate;
import java.util.regex.Pattern;

/**
* Analyzes a given text token. Populates various metrics regarding the token possibly being
Expand All @@ -14,6 +16,10 @@
* {@link #analyze(String, AnalyseResults)}.
*/
final class TokenAnalyse {
// Tokens like: "org.schema.game.common.data.world.Sector.access$200(Sector.java:120)"
private static final Predicate<String> IS_STACKTRACE_TOKEN =
Pattern.compile("(org|com|de|dev)(\\.[^.()]+){4,15}\\([^.()]+\\.java:\\d+\\)")
.asMatchPredicate();
private final ScamBlockerConfig config;

TokenAnalyse(ScamBlockerConfig config) {
Expand All @@ -27,7 +33,7 @@ final class TokenAnalyse {
* @param results metrics representing how suspicious the token is
*/
void analyze(String token, AnalyseResults results) {
if (token.isBlank()) {
if (token.isBlank() || IS_STACKTRACE_TOKEN.test(token)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ void setUp() {

when(scamConfig.getSuspiciousKeywords()).thenReturn(Set.of("nitro", "boob", "sexy", "sexi",
"esex", "steam", "gift", "onlyfans", "bitcoin", "btc", "promo", "trader", "trading",
"whatsapp", "crypto", "^claim", "teen", "adobe", "hack", "steamcommunity",
"freenitro", "^earn$", "^earning", ".exe$", "mrbeast"));
when(scamConfig.getHostWhitelist()).thenReturn(Set.of("discord.com", "discord.media",
"discordapp.com", "discordapp.net", "discordstatus.com", "thehackernews.com",
"gradle.org", "help.gradle.org", "youtube.com", "www.youtube.com",
"cdn.discordapp.com", "media.discordapp.net"));
"whatsapp", "crypto", "^claim", "teen", "adobe", "^hack$", "hacks",
"steamcommunity", "freenitro", "^earn$", "^earning", ".exe$", "mrbeast"));
when(scamConfig.getHostWhitelist())
.thenReturn(Set.of("discord.com", "discord.media", "discordapp.com", "discordapp.net",
"discordstatus.com", "thehackernews.com", "gradle.org", "help.gradle.org",
"youtube.com", "www.youtube.com", "cdn.discordapp.com", "media.discordapp.net",
"store.steampowered.com", "help.steampowered.com", "learn.microsoft.com"));
when(scamConfig.getHostBlacklist()).thenReturn(Set.of("bit.ly", "discord.gg", "teletype.in",
"t.me", "corematrix.us", "u.to", "steamcommunity.com", "goo.su", "telegra.ph",
"shorturl.at", "cheatings.xyz", "transfer.sh", "tobimoller.space"));
Expand Down Expand Up @@ -428,7 +429,25 @@ B2CWorkflow Builder (React Flow)
https://cdn.discordapp.com/attachments/1234/5678/1.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa&
https://cdn.discordapp.com/attachments/1234/5678/2.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa&
https://cdn.discordapp.com/attachments/1234/5678/3.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa&
https://cdn.discordapp.com/attachments/1234/5678/4.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa&""");
https://cdn.discordapp.com/attachments/1234/5678/4.png?ex=688cd552&is=688b83d2&hm=5787b53f08a488a22df6e3d2d43b4445ed0ced5f790e4f6e6e82810e38dba2aa&""",
"""
I’ll help the first 10 interested people learn how to start earning over $100,000 within a week.
You only send me 10% of your profits after you receive them.
No pressure. No gimmicks. Just results.
Send a friend request or DM me (HOW) on Telegram:
@Joinna_Dwayno
(Or use the link in my bio.)
If you’re not serious, don’t message.""",
"""
I'll help the first 10 people interested on how to start earning $100k or more within a week, but you will reimburse me 15% of your profits when you receive it.
Note: only interested people should send a friend request or send me a dm! ask me (HOW) via Telegram
@laula_david2
Or Click /use the the telegram link on my bio""",
"""
I’m looking for a couple of reliable people (🇺🇸) to help with simple recurring tasks. It’s only 1–2 hours of work per week, fully flexible on your schedule,
and pays $150+ per month, with the potential to increase to $300+ later. If you’re interested in easy side income with minimal time commitment,
send me a message💬 and I’ll share more details.
WhatsApp: +12534267893""");
}

private static List<String> provideRealFalsePositiveMessages() {
Expand Down Expand Up @@ -516,6 +535,30 @@ public static void main(String[] args){
It was pretty pricey, and the costs likely differ a lot from country to country
(keeping in mind that a portion is importing of equipment to NZ and some is labour in a very different market).
We have 13.5KW of storage, a 10KW inverter, 11.5KW of generation and an EV charger.
All up, on a 1% 'green loan', it was $40k NZD (~$23k USD)""");
All up, on a 1% 'green loan', it was $40k NZD (~$23k USD)""",
"https://store.steampowered.com/app/3176060/Emissary_Zero/",
"https://store.steampowered.com/app/3028330/Battlefield_REDSEC/",
"https://help.steampowered.com/en/faqs/view/49A1-B944-48B8-FF00",
"https://store.steampowered.com/api/appdetails?appids=8930 this endpoint is so cool",
"id play it if it was free maybe https://store.steampowered.com/app/1349230/5DChessWithMultiverseTime_Travel/",
"Why wouldn't they just take the $150 and not bother hacking an account to get the petfood sent?",
"""
https://learn.microsoft.com/en-us/powershell/scripting/discover-powershell?view=powershell-7.5
What makes PowerShell unique is that it accepts and returns .NET objects, rather than text.
because of that, but well it says that it returns .NET objects not that the commands are from .NET,
but well as i said i use cmd.exe because i do not know .NET nor powershell""",
"""
Exception in thread "ServerEntityWriterThread"
java.lang.NoSuchMethodError: org.schema.game.common.controller.rails.RailRelation.isLocked()Z
at org.schema.game.common.controller.rails.RailController.getDockedTag(RailController.java:2686)
at org.schema.game.common.controller.rails.RailController.getTag(RailController.java:2652)
at org.schema.game.common.controller.SegmentController.toTagStructure(SegmentController.java:2813)
at org.schema.game.common.data.EntityFileTools.write(EntityFileTools.java:57)
at org.schema.game.server.controller.GameServerController.writeEntity(GameServerController.java:2938)
at org.schema.game.common.data.world.Sector.writeSingle(Sector.java:2570)
at org.schema.game.common.data.world.Sector.writeEntity(Sector.java:2546)
at org.schema.game.common.data.world.Sector.access$200(Sector.java:120)
at org.schema.game.common.data.world.Sector$3.run(Sector.java:2665)
at org.schema.schine.network.server.ServerEntityWriterThread.run(ServerEntityWriterThread.java:74)""");
}
}
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id "com.diffplug.spotless" version "7.2.0"
id "org.sonarqube" version "6.3.1.5724"
id "com.diffplug.spotless" version "8.0.0"
id "org.sonarqube" version "7.0.1.6134"
id "name.remal.sonarlint" version "6.0.0"
}
repositories {
Expand All @@ -15,7 +15,7 @@ ext {
jooqVersion = '3.20.5'
jacksonVersion = '2.19.1'
chatGPTVersion = '0.18.2'
junitVersion = '5.13.2'
junitVersion = '6.0.0'
}

// Skips sonarlint during the build, useful for testing purposes.
Expand All @@ -35,7 +35,9 @@ sonarqube {
tasks.register('installLocalGitHook', Copy) {
from new File(rootProject.rootDir, 'scripts/pre-commit')
into new File(rootProject.rootDir, '.git/hooks')
fileMode 0775
filePermissions {
unix("rwxrwxr-x")
}
}
build.dependsOn installLocalGitHook

Expand All @@ -59,7 +61,7 @@ subprojects {
java {
toolchain {
// Nails the Java-Version of every Subproject
languageVersion = JavaLanguageVersion.of(24)
languageVersion = JavaLanguageVersion.of(25)
}
}

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ repositories {
}

dependencies {
implementation "gradle.plugin.org.flywaydb:gradle-plugin-publishing:10.6.0"
implementation 'nu.studer:gradle-jooq-plugin:9.0'
implementation "gradle.plugin.org.flywaydb:gradle-plugin-publishing:11.17.0"
implementation 'nu.studer:gradle-jooq-plugin:10.1.1'
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/database-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var sqliteVersion = "3.36.0.3"

dependencies {
implementation "org.xerial:sqlite-jdbc:${sqliteVersion}"
implementation 'org.flywaydb:flyway-core:8.0.0'
implementation 'org.flywaydb:flyway-core:11.17.0'
implementation "org.jooq:jooq:$jooqVersion"

jooqGenerator "org.xerial:sqlite-jdbc:${sqliteVersion}"
Expand Down
4 changes: 2 additions & 2 deletions database/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ plugins {
id 'java'
}

var sqliteVersion = "3.50.1.0"
var sqliteVersion = "3.51.0.0"

dependencies {
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation "org.xerial:sqlite-jdbc:${sqliteVersion}"
implementation 'org.flywaydb:flyway-core:11.13.0'
implementation 'org.flywaydb:flyway-core:11.17.0'
implementation "org.jooq:jooq:$jooqVersion"

implementation project(':utils')
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 1 addition & 4 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand Down Expand Up @@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

Expand Down Expand Up @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

Expand Down
3 changes: 1 addition & 2 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line

set CLASSPATH=


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
2 changes: 1 addition & 1 deletion wiki/Setup-project-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Alternatively, you can also work directly in the cloud, for free, and get starte
* [[Code in the cloud (codespaces)]]

## Prerequisites
* [Java 24](https://adoptium.net/temurin/releases?version=24) installed
* [Java 25](https://adoptium.net/temurin/releases?version=25) installed
* your favorite Java IDE or text editor, e.g. [IntelliJ](https://www.jetbrains.com/idea/download/) or [Eclipse](https://www.eclipse.org/downloads/)
* [`git`](https://git-scm.com/downloads) installed (or any GUI or IDE plugin)
* [`gradle`](https://gradle.org/releases/) available (or any GUI or IDE plugin), you can either install it or use our provided wrapper
Expand Down
Loading