Compare commits

...
Sign in to create a new pull request.

121 commits

Author SHA1 Message Date
fd2eafac95
test again
All checks were successful
Build & Publish / build (push) Successful in 2m14s
2025-06-16 18:28:37 +02:00
95dc9bffdc
test again
All checks were successful
Build & Publish / build (push) Successful in 12m13s
2025-06-16 18:03:27 +02:00
fa8dd0ab14
remove cache from qemu action
All checks were successful
Build & Publish / build (push) Successful in 7m45s
2025-06-16 17:50:30 +02:00
8b49b19b1a
test caching
Some checks failed
Build & Publish / build (push) Has been cancelled
2025-06-16 17:46:48 +02:00
3b292d6ddd
[skip ci] move privacy-policy.md and terms-of-service.md into the root 2025-06-16 12:43:35 +02:00
4d5ba6754a
[skip ci] remove plugins from settings.gradle.kts 2025-06-16 12:40:46 +02:00
bf93c329b7
finish dependency update, also use the newer docker file template haha
All checks were successful
Build & Publish / build (push) Successful in 13m6s
2025-06-16 02:20:25 +02:00
6fa42168ac [skip ci] Merge pull request 'Update dependency org.codehaus.groovy:groovy to v3.0.25' (#5) from renovate/groovy-monorepo into root
Reviewed-on: #5
2025-06-16 02:05:19 +02:00
87108407a2 [skip ci] Merge pull request 'Update plugin dev.kordex.gradle.kordex to v1.7.1' (#14) from renovate/dev.kordex.gradle.kordex-1.x into root
Reviewed-on: #14
2025-06-16 02:05:05 +02:00
7f39c0767c [skip ci] Merge pull request 'Migrate renovate config' (#16) from renovate/migrate-config into root
Reviewed-on: #16
2025-06-16 02:04:43 +02:00
32208e0496 Migrate config renovate.json 2025-06-16 00:01:13 +00:00
adb69e1f1f Update plugin dev.kordex.gradle.kordex to v1.7.1 2025-06-16 00:01:10 +00:00
f67b016014 Update dependency org.codehaus.groovy:groovy to v3.0.25 2025-06-16 00:01:02 +00:00
27b4234cf7 [skip ci] Merge pull request 'Update plugin dev.kordex.gradle.docker to v1.7.1' (#13) from renovate/dev.kordex.gradle.docker-1.x into root
Reviewed-on: #13
2025-06-16 01:53:20 +02:00
7748d1b413 [skip ci] Merge pull request 'Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.10.2' (#10) from renovate/kotlinx-coroutines-monorepo into root
Reviewed-on: #10
2025-06-16 01:52:58 +02:00
308df01d54 [skip ci] Merge pull request 'Update dependency io.github.oshai:kotlin-logging to v7.0.7' (#3) from renovate/logging into root
Reviewed-on: #3
2025-06-16 01:52:38 +02:00
b42f65bce2 [skip ci] Merge pull request 'Update dependency ch.qos.logback:logback-classic to v1.5.18' (#2) from renovate/logback-monorepo into root
Reviewed-on: #2
2025-06-16 01:52:11 +02:00
9f30a1415f [skip ci] Merge pull request 'Update dependency org.fusesource.jansi:jansi to v2.4.2' (#6) from renovate/jansi into root
Reviewed-on: #6
2025-06-16 01:51:25 +02:00
e5c731c016 [skip ci] Merge pull request 'Update https://github.com/docker/build-push-action action to v6' (#15) from renovate/https-github.com-docker-build-push-action-6.x into root
Reviewed-on: #15
2025-06-16 01:50:55 +02:00
b19242fc8a Update https://github.com/docker/build-push-action action to v6 2025-06-15 22:03:09 +00:00
881298dd15 Update plugin dev.kordex.gradle.docker to v1.7.1 2025-06-15 22:02:56 +00:00
700a2410ef Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.10.2 2025-06-15 22:02:50 +00:00
b2db4cdfc3 Update dependency org.fusesource.jansi:jansi to v2.4.2 2025-06-15 22:02:45 +00:00
add22d993c Update dependency io.github.oshai:kotlin-logging to v7.0.7 2025-06-15 22:02:25 +00:00
91cf4d2608 Update dependency ch.qos.logback:logback-classic to v1.5.18 2025-06-15 22:02:09 +00:00
db4096e71a [skip ci] Merge pull request 'Update dependency com.github.twitch4j:twitch4j to v1.25.0' (#8) from renovate/twitch4j into root
Reviewed-on: #8
2025-06-15 23:47:46 +02:00
b601693905 Update dependency com.github.twitch4j:twitch4j to v1.25.0 2025-06-15 23:47:23 +02:00
07cd0f1aed [skip ci] Merge pull request 'Update kotlin monorepo to v2.1.21' (#7) from renovate/kotlin-monorepo into root
Reviewed-on: #7
2025-06-15 23:47:02 +02:00
080234fa0a Update kotlin monorepo to v2.1.21 2025-06-15 23:46:39 +02:00
35bce0277f [skip ci] Merge pull request 'Update dependency org.litote.kmongo:kmongo-coroutine-serialization to v5.2.1' (#12) from renovate/kmongo into root
Reviewed-on: #12
2025-06-15 23:45:31 +02:00
ec202e631b Update dependency org.litote.kmongo:kmongo-coroutine-serialization to v5.2.1 2025-06-15 23:44:47 +02:00
110a3cffce Merge pull request 'Update dependency gradle to v8.14.2' (#9) from renovate/gradle-8.x into root [skip ci]
Reviewed-on: #9
2025-06-15 23:43:39 +02:00
b6f0209529 Update dependency gradle to v8.14.2 2025-06-15 23:43:07 +02:00
4ebe867f03 Merge pull request 'Update dependency org.jetbrains.kotlinx:kotlinx-serialization-core to v1.8.1' (#11) from renovate/kx.ser into root
Some checks failed
Build & Publish / build (push) Has been cancelled
Reviewed-on: #11
2025-06-15 23:41:54 +02:00
089f09031e Update dependency org.jetbrains.kotlinx:kotlinx-serialization-core to v1.8.1 2025-06-15 21:39:06 +00:00
e2651e17f2 [skip ci] update <filename> 2025-06-15 23:19:20 +02:00
9f2ed39bb8 Merge pull request 'Configure Renovate' (#1) from renovate/configure into root
All checks were successful
Build & Publish / build (push) Successful in 12m31s
Reviewed-on: #1
2025-06-15 23:14:00 +02:00
8b6f60c1ea Update renovate.json 2025-06-15 23:13:01 +02:00
a003f54e72 Merge branch 'root' into renovate/configure 2025-06-15 23:08:22 +02:00
62ccfcd8bf Update .github/workflows/root.yml
Some checks failed
Build & Publish / build (push) Has been cancelled
2025-06-15 23:08:06 +02:00
f162ef0d7e Add renovate.json
Some checks failed
Build & Publish / build (push) Has been cancelled
2025-06-15 21:05:59 +00:00
806cfe8f46 Update .github/workflows/root.yml
Some checks failed
Build & Publish / build (push) Failing after 11m33s
2025-06-14 23:42:55 +02:00
a1b3587af4 Update .github/workflows/root.yml 2025-05-20 10:33:45 +02:00
550912020e Update .github/workflows/root.yml 2025-05-20 10:25:17 +02:00
8788c0100d Update .github/workflows/root.yml 2025-04-15 00:12:16 +02:00
e8250b2e3a Update .github/workflows/root.yml 2025-04-03 17:06:03 +02:00
da4c983d89
remove minimum allocation, but keep max allocation 2025-03-18 11:08:05 +01:00
469dbff421
update twitch4j 2025-03-12 20:18:49 +01:00
58275f2262
update some dependencies 2025-03-10 14:30:31 +01:00
c6cf204f44
MAYBE INIT A TWITCH CLIENT WHEN MIGRATING AAAAAAAAA 2025-02-15 11:34:17 +01:00
836e938dce
Streamers are now saved by both name and id, and on startup updates to the new name if there is one. 2025-02-15 11:10:51 +01:00
b680ce4ef4 [skip ci] yep should change this lol 2025-02-15 03:38:42 +01:00
63102a7ba2 change registry to DigitalOcean 2025-02-15 03:32:32 +01:00
c5ef4b0b56 Update .github/workflows/root.yml 2025-02-09 19:39:25 +01:00
8ce36de89a
gradle 8.12.1 2025-01-25 02:39:18 +01:00
3a04c4d6ed Upgrade Version to 1.1-SNAPSHOT
Signed-off-by: jansel <me@jansel.dev>
2025-01-22 11:38:34 +01:00
7969b988d7 [skip ci] change run name so it doesnt just take the last commit name 2025-01-17 00:35:53 +01:00
5dc0c64e0e [skip ci] change scheduled builds to just monday midnight 2025-01-17 00:31:24 +01:00
7d4d0fda3f
upgrade various versions, including gradle to 8.12 2025-01-08 18:45:17 +01:00
9228529f18 fuck the cache, it didnt wanna work properly anyways 2025-01-05 21:14:59 +01:00
2c36e0c3b5 Update .github/workflows/root.yml 2024-12-27 03:53:10 +01:00
d89a881499 Update .github/workflows/root.yml 2024-12-27 03:35:00 +01:00
1dda612917 Update .github/workflows/root.yml 2024-12-27 03:28:23 +01:00
6bb57cd591 Update .github/workflows/root.yml 2024-12-27 03:27:41 +01:00
cd7389e347 Update .github/workflows/root.yml 2024-12-14 18:53:03 +00:00
afc7f29e87 [skip ci] edit readme 2024-12-13 03:56:10 +00:00
7e72fdcb79 Delete .github/renovate.json 2024-12-13 03:39:57 +00:00
72180525a4 reverse order 2024-12-13 03:10:16 +00:00
d3c2f54fc6 Update .github/workflows/root.yml 2024-12-13 03:04:23 +00:00
c689e4c9a0 Update .github/workflows/root.yml 2024-12-13 02:59:46 +00:00
19daee5212 Update .github/workflows/root.yml 2024-12-13 02:49:10 +00:00
47f281ed5b [skip ci] delete unused workflow 2024-12-11 21:39:31 +00:00
ae8b09c405 [skip ci] delete unused workflow
Signed-off-by: jansel <me@jansel.dev>
2024-12-11 21:39:11 +00:00
2270f3d725 update java to 21 2024-12-11 21:34:08 +00:00
0548bf56bd pls let the caching work 2024-12-11 21:24:21 +00:00
2d0f156f45 Update .github/workflows/root.yml 2024-12-11 21:12:43 +00:00
834d357855 Update .github/workflows/root.yml 2024-12-11 21:06:04 +00:00
49e1d4149f Update .github/workflows/root.yml 2024-12-11 21:03:53 +00:00
dd7f3504ba let this work? 2024-12-11 20:58:45 +00:00
f9f62ae9c6 Update .github/workflows/root.yml 2024-12-11 12:45:42 +00:00
6ceb20aee6 Update .github/workflows/root.yml 2024-12-11 12:40:03 +00:00
5f07b1b61d Update .github/workflows/ci.yml 2024-12-11 12:39:04 +00:00
3093900ceb Update .github/workflows/root.yml 2024-12-11 02:19:26 +00:00
789d58f99a
rewrite the response better when an attempt is made to ping everyone as a role ping 2024-12-09 17:56:03 +01:00
d4f750ba68
maybe this is more clear regarding everyone pings (I have no clue if the described workaround works, too lazy) 2024-12-06 13:46:42 +01:00
891c544ad8
[skip ci] edit renovate.json 2024-12-05 18:34:17 +01:00
76f775d292
optimize code and imports 2024-12-05 18:31:48 +01:00
5728ac716c
done a lot of shit that will be too much to explain, especially because for once I had to comment my code which I don't like. 2024-12-03 22:20:15 +01:00
6fb1e794bd
how tf did this never work (it does now tho 2024-12-03 21:12:44 +01:00
4f5dc82d0b
Merge remote-tracking branch 'origin/root' into root 2024-11-28 09:51:44 +01:00
b9f8def375
finally i'm able to update gradle to 8.11.1 2024-11-28 09:51:13 +01:00
e78864ae8b
MAYBE ALSO IMPLEMENT CHANGES THAT WERE MADE SINCE THIS BRANCH WAS MADE 2024-11-28 09:51:12 +01:00
f0d9a037c1
more rebasing 2024-11-28 09:51:01 +01:00
e05bd9fe9c
rebasing 2024-11-28 09:50:04 +01:00
5a2b1ec438
finally i'm able to update gradle to 8.11.1 2024-11-28 09:45:03 +01:00
45da7ed2da
MAYBE ALSO IMPLEMENT CHANGES THAT WERE MADE SINCE THIS BRANCH WAS MADE 2024-11-28 09:06:11 +01:00
accd4d1975
better loading system should work, will see it later during prod 2024-11-28 09:01:24 +01:00
a3f31b64d0
Merge branch 'root' into refactor/different-loading-system
# Conflicts:
#	src/main/kotlin/dev/jansel/feixiao/App.kt
2024-11-28 08:43:47 +01:00
feb82122b8
Merge branch 'root' into refactor/depUpdates 2024-11-28 04:38:17 +01:00
f5270e3eb7
revert gradle version to 8.10.2 2024-11-28 04:26:40 +01:00
1a22b39430
Merge pull request #11 from NotJansel/renovate/docker-login-action-3.x
Update docker/login-action action to v3
2024-11-28 04:07:11 +01:00
840e0aeac8
Merge pull request #10 from NotJansel/renovate/docker-build-push-action-6.x [skip ci]
Update docker/build-push-action action to v6
2024-11-28 04:06:54 +01:00
93a052c683
Merge pull request #8 from NotJansel/renovate/major-github-artifact-actions [skip ci]
Update actions/upload-artifact action to v4
2024-11-28 04:06:31 +01:00
08903ef187
Merge pull request #5 from NotJansel/renovate/gradle-8.x [skip ci]
Update dependency gradle to v8.11.1
2024-11-28 04:04:49 +01:00
00dad5405d
Merge pull request #9 from NotJansel/renovate/major-kmongo [skip ci]
Update dependency org.litote.kmongo:kmongo-coroutine-serialization to v5
2024-11-28 04:04:27 +01:00
a64a5cd993
Merge pull request #3 from NotJansel/renovate/groovy-monorepo [skip ci]
Update dependency org.codehaus.groovy:groovy to v3.0.23
2024-11-28 04:03:06 +01:00
renovate[bot]
e283d68edb
Update dependency org.codehaus.groovy:groovy to v3.0.23
[skip ci]
2024-11-28 03:02:52 +00:00
121746b4b5
Merge pull request #4 from NotJansel/renovate/twitch4j [skip ci]
Update dependency com.github.twitch4j:twitch4j to v1.23.0
2024-11-28 04:02:40 +01:00
renovate[bot]
6f0276fc95
Update docker/login-action action to v3
[skip ci]
2024-11-28 03:00:57 +00:00
renovate[bot]
2243329fae
Update docker/build-push-action action to v6
[skip ci]
2024-11-28 03:00:54 +00:00
renovate[bot]
7736b99eea
Update dependency org.litote.kmongo:kmongo-coroutine-serialization to v5
[skip ci]
2024-11-28 03:00:51 +00:00
renovate[bot]
352591ac1a
Update actions/upload-artifact action to v4
[skip ci]
2024-11-28 03:00:48 +00:00
renovate[bot]
9b0a21131e
Update dependency gradle to v8.11.1
[skip ci]
2024-11-28 03:00:35 +00:00
renovate[bot]
9b6c2455c5
Update dependency com.github.twitch4j:twitch4j to v1.23.0
[skip ci]
2024-11-28 02:58:49 +00:00
4419999325
Merge pull request #2 from NotJansel/renovate/configure
Configure Renovate
2024-11-28 03:58:28 +01:00
2d5fa8708b
Update renovate.json [skip ci] 2024-11-28 03:56:56 +01:00
7ef5f34ee6
Update and rename renovate.json to .github/renovate.json 2024-11-28 03:50:56 +01:00
renovate[bot]
2dd0211353
Add renovate.json 2024-11-28 02:41:13 +00:00
c96e4f56ee
Merge branch 'refactor/translations-and-latest-kordex' into root 2024-11-27 23:51:47 +01:00
8408603476
print online message in a seperate text channel 2024-11-25 03:32:56 +01:00
be28f7ae7e
try a different approach on loading stuff 2024-11-21 08:58:36 +01:00
30 changed files with 524 additions and 206 deletions

View file

@ -1,36 +0,0 @@
name: Build (CI)
on:
push:
branches-ignore:
- root
- develop
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Gradle (Build)
run: "./gradlew build"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Build and Deploy Artifacts
path: build/libs/*.jar

View file

@ -1,33 +0,0 @@
name: Build & Publish
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Gradle (Build)
run: "./gradlew build"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Build and Deploy Artifacts
path: build/libs/*.jar

View file

@ -1,6 +1,7 @@
name: Build & Publish
on:
workflow_dispatch:
push:
branches:
- root
@ -8,40 +9,73 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: https://github.com/actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: https://github.com/docker/setup-qemu-action@v3
with:
cache-image: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: https://github.com/docker/setup-buildx-action@v3
- name: Set up Java
uses: actions/setup-java@v4
uses: https://github.com/actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
- name: "Restore Cache"
id: restore-cache
uses: https://data.forgejo.org/actions/cache/restore@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
key: gradle-store
- name: Grant execute permission for gradlew
run: chmod +x gradlew
with:
dependency-graph: generate-and-submit
cache-disabled: true
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Gradle (Build)
run: "./gradlew build"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
- name: Login to DigitalOcean Registry
uses: https://github.com/docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
registry: registry.digitalocean.com
username: ${{ secrets.DOMAIL }}
password: ${{ secrets.DOKEY }}
- name: Build and push
uses: docker/build-push-action@v5
uses: https://github.com/docker/build-push-action@v6
with:
context: .
platforms: linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/notjansel/feixiao:latest
tags: registry.digitalocean.com/jansel/feixiao:latest,registry.digitalocean.com/jansel/feixiao:${{ steps.date.outputs.date }}
- name: "Save Cache"
uses: https://data.forgejo.org/actions/cache/save@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.m2/repository
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

9
.idea/Feixiao.iml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

2
.idea/compiler.xml generated
View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="13">
<bytecodeTargetLevel target="21">
<module name="ext-common" target="1.8" />
<module name="ext-common.main" target="1.8" />
<module name="ext-common.test" target="1.8" />

2
.idea/kotlinc.xml generated
View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.0.21" />
<option name="version" value="2.1.21" />
</component>
</project>

12
.idea/material_theme_project_new.xml generated Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="-7d6c680f:19397de9638:-7ffe" />
</MTProjectMetadataState>
</option>
</component>
</project>

2
.idea/misc.xml generated
View file

@ -5,7 +5,7 @@
<file type="web" url="file://$PROJECT_DIR$/../ext-common" />
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" project-jdk-name="azul-21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules/feixiao.iml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/../.." dumb="true">
<excludeFolder url="file://$MODULE_DIR$/../../.kotlin" />
</content>
</component>
</module>

View file

@ -5,3 +5,5 @@
Blanketbot is a Discord bot, coded to notify you when your favorite twitch streamer goes live. To simply set it up, add the Bot to your server through the Invite link above and use the `/streamer add` command to add your favorite streamer. The bot will then notify you when the streamer goes live.
If issues arise, please don't hesitate to create an issue here on GitHub.
Info if you're looking at this from GitHub and not the Gitea Instance: This repo now is used as a mirror, Issues will still be looked at here on GitHub. For PR's, I will create a patchfile from that pr and apply it manually on the [origin repo](https://git.jansel.dev/jansel/feixiao)

View file

@ -2,17 +2,17 @@ import dev.kordex.gradle.plugins.docker.file.*
import dev.kordex.gradle.plugins.kordex.DataCollection
plugins {
kotlin("jvm")
kotlin("plugin.serialization")
distribution
id("com.github.johnrengelman.shadow")
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
id("dev.kordex.gradle.docker")
id("dev.kordex.gradle.kordex")
alias(libs.plugins.kordex.plugin)
alias(libs.plugins.kordex.docker)
}
group = "dev.jansel"
version = "1.0-SNAPSHOT"
version = "1.2-SNAPSHOT"
dependencies {
@ -31,9 +31,26 @@ dependencies {
implementation(libs.logging)
}
// Configure distributions plugin
distributions {
main {
distributionBaseName = project.name
contents {
// Copy the LICENSE file into the distribution
from("LICENSE")
// Exclude src/main/dist/README.md
exclude("README.md")
}
}
}
kordEx {
kordExVersion = "2.3.1-SNAPSHOT"
jvmTarget = 21
ignoreIncompatibleKotlinVersion = true
bot {
// See https://docs.kordex.dev/data-collection.html
@ -58,37 +75,51 @@ docker {
// Each function (aside from comment/emptyLine) corresponds to a Dockerfile instruction.
// See: https://docs.docker.com/reference/dockerfile/
from("azul/zulu-openjdk-alpine:21-jre-headless-latest")
from("openjdk:21-jdk-slim")
emptyLine()
comment("Create required directories")
runShell("mkdir -p /bot/plugins")
runShell("mkdir -p /bot/data")
emptyLine()
copy("build/libs/$name-*-all.jar", "/bot/bot.jar")
runShell("mkdir -p /dist/out")
emptyLine()
// Add volumes for locations that you need to persist. This is important!
comment("Declare required volumes")
volume("/bot/data") // Storage for data files
volume("/bot/plugins") // Plugin ZIP/JAR location
emptyLine()
comment("Copy the distribution files into the container")
copy("build/distributions/${project.name}-${project.version}.tar", "/dist")
emptyLine()
comment("Extract the distribution files, and prepare them for use")
runShell("tar -xf /dist/${project.name}-${project.version}.tar -C /dist/out")
if (file("src/main/dist/plugins").isDirectory) {
runShell("mv /dist/out/${project.name}-${project.version}/plugins/* /bot/plugins")
}
runShell("chmod +x /dist/out/${project.name}-${project.version}/bin/$name")
emptyLine()
comment("Clean up unnecessary files")
runShell("rm /dist/${project.name}-${project.version}.tar")
emptyLine()
comment("Set the correct working directory")
workdir("/bot")
emptyLine()
entryPointExec(
"java", "-Xms2G", "-Xmx2G",
"-jar", "/bot/bot.jar"
)
comment("Run the distribution start script")
entryPointExec("/dist/out/${project.name}-${project.version}/bin/$name")
}
}
tasks.wrapper {
gradleVersion = "8.11.1"
distributionType = Wrapper.DistributionType.BIN
}

View file

@ -1,16 +1,17 @@
[versions]
kotlin = "2.0.21" # Note: Plugin versions must be updated in the settings.gradle.kts too
kotlin = "2.1.21" # Note: Plugin versions must be updated in the settings.gradle.kts too
groovy = "3.0.22"
jansi = "2.4.1"
kx-ser = "1.7.3"
logback = "1.5.12"
groovy = "3.0.25"
jansi = "2.4.2"
kx-ser = "1.8.1"
logback = "1.5.18"
logback-groovy = "1.14.5"
logging = "7.0.0"
twitch4j = "1.22.0"
logging = "7.0.7"
twitch4j = "1.25.0"
events4j = "0.12.2"
kx-coroutines = "1.9.0"
kmongo = "4.9.0"
kx-coroutines = "1.10.2"
kmongo = "5.2.1"
kordex-gradle = "1.7.1"
[libraries]
groovy = { module = "org.codehaus.groovy:groovy", version.ref = "groovy" }
@ -24,3 +25,11 @@ logging = { module = "io.github.oshai:kotlin-logging", version.ref = "logging" }
twitch4j = { module = "com.github.twitch4j:twitch4j", version.ref = "twitch4j" }
events4j = { module = "com.github.philippheuer.events4j:events4j-handler-reactor", version.ref = "events4j" }
kmongo = { module="org.litote.kmongo:kmongo-coroutine-serialization", version.ref = "kmongo" }
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kordex-docker = { id = "dev.kordex.gradle.docker", version.ref = "kordex-gradle" }
kordex-plugin = { id = "dev.kordex.gradle.kordex", version.ref = "kordex-gradle" }

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

9
gradlew vendored
View file

@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -115,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@ -206,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
@ -214,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.

4
gradlew.bat vendored
View file

@ -70,11 +70,11 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%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" %*
:end
@rem End local scope for the variables with windows NT shell

15
renovate.json Normal file
View file

@ -0,0 +1,15 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"packageRules": [
{
"matchUpdateTypes": [
"minor",
"patch"
]
}
],
"prHourlyLimit": 0
}

View file

@ -1,20 +1,10 @@
pluginManagement {
plugins {
// Update this in libs.version.toml when you change it here.
kotlin("jvm") version "2.0.21"
kotlin("plugin.serialization") version "2.0.21"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("dev.kordex.gradle.docker") version "1.5.8"
id("dev.kordex.gradle.kordex") version "1.5.8"
}
repositories {
gradlePluginPortal()
mavenCentral()
maven("https://snapshots-repo.kordex.dev")
maven("https://releases-repo.kordex.dev")
maven("https://snapshots-repo.kordex.dev")
}
}

View file

@ -1,32 +1,23 @@
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package dev.jansel.feixiao
import com.github.philippheuer.events4j.reactor.ReactorEventHandler
import com.github.twitch4j.TwitchClient
import com.github.twitch4j.TwitchClientBuilder
import com.github.twitch4j.events.ChannelGoLiveEvent
import dev.jansel.feixiao.database.collections.StreamerCollection
import dev.jansel.feixiao.extensions.EventHooks
import dev.jansel.feixiao.extensions.StreamerCommand
import dev.jansel.feixiao.utils.database
import dev.jansel.feixiao.utils.token
import dev.jansel.feixiao.utils.twitchcid
import dev.jansel.feixiao.utils.twitchcs
import dev.kord.core.entity.channel.GuildMessageChannel
import dev.jansel.feixiao.utils.twitch
import dev.kordex.core.ExtensibleBot
import dev.kordex.core.i18n.SupportedLocales
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
var twitchClient: TwitchClient? = null
val logger = KotlinLogging.logger { }
var botRef: ExtensibleBot? = null
suspend fun main() {
val bot = ExtensibleBot(token) {
botRef = ExtensibleBot(token) {
database(true)
twitch(true)
extensions {
add(::EventHooks)
add(::StreamerCommand)
@ -35,55 +26,8 @@ suspend fun main() {
applicationCommandLocale(SupportedLocales.ENGLISH, SupportedLocales.GERMAN)
}
}
twitchClient = TwitchClientBuilder.builder()
.withEnableHelix(true)
.withClientId(twitchcid)
.withClientSecret(twitchcs)
.withDefaultEventHandler(ReactorEventHandler::class.java)
.build()
twitchClient!!.eventManager.onEvent(ChannelGoLiveEvent::class.java) {
logger.info { "${it.channel.name} went live!" }
runBlocking {
launch {
val streamer = StreamerCollection().getData(it.channel.name)
for (server in streamer!!.servers) {
val channel = bot.kordRef.getChannelOf<GuildMessageChannel>(server.channelId)
val role = server.roleId
val livemessage = server.liveMessage
if (role != null) {
if (livemessage != null) {
channel?.createMessage(
livemessage
.replace("{name}", it.channel.name)
.replace("{category}", it.stream.gameName)
.replace("{title}", it.stream.title)
.replace("{url}", "https://twitch.tv/${it.channel.name}")
.replace("{role}", "<@&$role>")
)
} else {
channel?.createMessage("<@&$role> https://twitch.tv/${it.channel.name} went live streaming ${it.stream.gameName}: ${it.stream.title}")
}
} else {
if (livemessage != null) {
channel?.createMessage(
livemessage
.replace("{name}", it.channel.name)
.replace("{category}", it.stream.gameName)
.replace("{title}", it.stream.title)
.replace("{url}", "https://twitch.tv/${it.channel.name}")
)
} else {
channel?.createMessage("https://twitch.tv/${it.channel.name} went live streaming ${it.stream.gameName}: ${it.stream.title}")
}
}
}
}
}
}
bot.start()
botRef!!.start()
}

View file

@ -1,8 +1,14 @@
package dev.jansel.feixiao.database
import com.github.philippheuer.events4j.reactor.ReactorEventHandler
import com.github.twitch4j.TwitchClientBuilder
import dev.jansel.feixiao.database.collections.MetaCollection
import dev.jansel.feixiao.database.entities.MetaData
import dev.jansel.feixiao.database.migrations.v1
import dev.jansel.feixiao.database.migrations.v2
import dev.jansel.feixiao.twitchClient
import dev.jansel.feixiao.utils.twitchcid
import dev.jansel.feixiao.utils.twitchcs
import dev.kordex.core.koin.KordExKoinComponent
import io.github.oshai.kotlinlogging.KotlinLogging
import org.koin.core.component.inject
@ -15,6 +21,13 @@ object Migrator : KordExKoinComponent {
suspend fun migrate() {
logger.info { "Starting main database migration" }
logger.info { "Initializing Twitch client just in case" }
twitchClient = TwitchClientBuilder.builder()
.withEnableHelix(true)
.withDefaultEventHandler(ReactorEventHandler::class.java)
.withClientId(twitchcid)
.withClientSecret(twitchcs)
.build()
var meta = mainMetaCollection.get()
@ -35,6 +48,7 @@ object Migrator : KordExKoinComponent {
try {
when (nextVersion) {
1 -> ::v1
2 -> ::v2
else -> break
}(db.mongo)

View file

@ -3,6 +3,7 @@ package dev.jansel.feixiao.database.collections
import dev.jansel.feixiao.database.Database
import dev.jansel.feixiao.database.entities.Server
import dev.jansel.feixiao.database.entities.StreamerData
import dev.jansel.feixiao.utils.getTwitchIdByName
import dev.kord.common.entity.Snowflake
import dev.kordex.core.koin.KordExKoinComponent
import org.koin.core.component.inject
@ -20,7 +21,7 @@ class StreamerCollection : KordExKoinComponent {
suspend fun getData(channelName: String): StreamerData? =
collection.findOne(StreamerData::name eq channelName)
suspend fun updateData(
suspend fun addData(
guildId: Snowflake,
channelId: Snowflake,
streamerName: String,
@ -35,11 +36,98 @@ class StreamerCollection : KordExKoinComponent {
)
} else {
collection.insertOne(
StreamerData(streamerName, listOf(Server(guildId, channelId, roleId, liveMessage)))
StreamerData(streamerName, getTwitchIdByName(streamerName), listOf(Server(guildId, channelId, roleId, liveMessage)))
)
}
}
/**
* Update the roleId
* @param streamerName: The name of the streamer
* @param roleId: The roleId to update
* @param guildId: The guildId to update
* @param noOverload: This is needed to avoid a conflict with the other updateData function, set to true or false, doesn't matter
* @return 0 = success, 1 = no Server associated with the guildId, 2 = no StreamerData associated with the streamerName
*/
suspend fun updateData(
streamerName: String,
roleId: Snowflake,
guildId: Snowflake,
noOverload: Boolean = false // this is needed to avoid a conflict with the other updateData function
): Int {
val coll = collection.findOne(StreamerData::name eq streamerName)
if (coll != null) {
val temp = coll.servers.find { server -> server.guildId == guildId }
if (temp == null) return 1
collection.updateMany(
StreamerData::name eq streamerName,
setValue(
StreamerData::servers,
coll.servers - temp + Server(guildId, temp.channelId, roleId, temp.liveMessage)
)
)
return 0
}
return 2
}
/**
* Update the liveMessage
* @param streamerName: The name of the streamer
* @param liveMessage: The liveMessage to update
* @param guildId: The guildId to update
* @return 0 = success, 1 = no Server associated with the guildId, 2 = no StreamerData associated with the streamerName
*/
suspend fun updateData(
streamerName: String,
liveMessage: String?,
guildId: Snowflake
): Int {
val coll = collection.findOne(StreamerData::name eq streamerName)
if (coll != null) {
val temp = coll.servers.find { server -> server.guildId == guildId }
if (temp == null) return 1
collection.updateMany(
StreamerData::name eq streamerName,
setValue(
StreamerData::servers,
coll.servers - temp + Server(guildId, temp.channelId, temp.roleId, liveMessage)
)
)
return 0
}
return 2
}
/**
* Update the channelId
* @param streamerName: The name of the streamer
* @param channelId: The channelId to update
* @param guildId: The guildId to update
* @return 0 = success, 1 = no Server associated with the guildId, 2 = no StreamerData associated with the streamerName
*/
suspend fun updateData(
streamerName: String,
channelId: Snowflake,
guildId: Snowflake
): Int {
val coll = collection.findOne(StreamerData::name eq streamerName)
if (coll != null) {
val temp = coll.servers.find { server -> server.guildId == guildId }
if (temp == null) return 1
collection.updateMany(
StreamerData::name eq streamerName,
setValue(
StreamerData::servers,
coll.servers - temp + Server(guildId, channelId, temp.roleId, temp.liveMessage)
)
)
return 0
}
return 2
}
suspend fun removeData(
guildId: Snowflake,
channelId: Snowflake,

View file

@ -6,6 +6,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class StreamerData(
val name: String,
val id: String?,
val servers: List<Server>
)

View file

@ -0,0 +1,16 @@
package dev.jansel.feixiao.database.migrations
import dev.jansel.feixiao.database.entities.StreamerData
import dev.jansel.feixiao.utils.getTwitchIdByName
import org.litote.kmongo.coroutine.CoroutineDatabase
import org.litote.kmongo.eq
import org.litote.kmongo.setValue
suspend fun v2(db: CoroutineDatabase) {
db.getCollection<StreamerData>("streamerData").findOne(StreamerData::id eq null)?.let {
db.getCollection<StreamerData>("streamerData").updateOne(
StreamerData::name eq it.name,
setValue(StreamerData::id, getTwitchIdByName(it.name))
)
}
}

View file

@ -4,10 +4,17 @@ import dev.jansel.feixiao.database.collections.StreamerCollection
import dev.jansel.feixiao.database.entities.StreamerData
import dev.jansel.feixiao.logger
import dev.jansel.feixiao.twitchClient
import dev.jansel.feixiao.utils.getTwitchIdByName
import dev.jansel.feixiao.utils.getTwitchNameById
import dev.jansel.feixiao.utils.tchannelid
import dev.jansel.feixiao.utils.tserverid
import dev.kord.core.behavior.getChannelOf
import dev.kord.core.entity.channel.GuildMessageChannel
import dev.kord.core.event.gateway.ReadyEvent
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.event
import org.litote.kmongo.eq
import org.litote.kmongo.setValue
class EventHooks : Extension() {
override val name = "eventhooks"
@ -16,12 +23,17 @@ class EventHooks : Extension() {
event<ReadyEvent> {
action {
logger.info { "Bot is ready!" }
val onlineLog =
kord.getGuildOrNull(tserverid)?.getChannelOf<GuildMessageChannel>(tchannelid)
onlineLog?.createMessage("Bot Online!")
kord.editPresence { listening("the database") }
// check every entry in the database and enable the stream event listener if a server is listening to the streamer
StreamerCollection().collection.find().toList().forEach {
if (it.servers.isNotEmpty()) {
twitchClient!!.clientHelper.enableStreamEventListener(it.name)
logger.info { "Enabled stream event listener for ${it.name}" }
val currentName = getTwitchNameById(it.id!!)
twitchClient!!.clientHelper.enableStreamEventListener(currentName)
logger.info { "Enabled stream event listener for $currentName" }
StreamerCollection().collection.updateOne(StreamerData::name eq it.name, setValue(StreamerData::name, currentName))
} else {
logger.info { "No servers are listening to ${it.name}, deleting from the database..." }
StreamerCollection().collection.deleteMany(StreamerData::name eq it.name)

View file

@ -1,6 +1,7 @@
package dev.jansel.feixiao.extensions
import dev.jansel.feixiao.database.collections.StreamerCollection
import dev.jansel.feixiao.database.entities.StreamerData
import dev.jansel.feixiao.i18n.Translations
import dev.jansel.feixiao.twitchClient
import dev.kord.common.entity.Permission
@ -8,12 +9,10 @@ import dev.kordex.core.checks.anyGuild
import dev.kordex.core.checks.hasPermission
import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.application.slash.publicSubCommand
import dev.kordex.core.commands.converters.impl.channel
import dev.kordex.core.commands.converters.impl.optionalRole
import dev.kordex.core.commands.converters.impl.optionalString
import dev.kordex.core.commands.converters.impl.string
import dev.kordex.core.commands.converters.impl.*
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import org.litote.kmongo.eq
class StreamerCommand : Extension() {
override val name = "streaming"
@ -31,7 +30,21 @@ class StreamerCommand : Extension() {
}
action {
val streamer = arguments.streamer
StreamerCollection().updateData(
StreamerCollection().getData(streamer)?.servers?.forEach {
if (it.guildId == guild!!.id) {
respond {
content = "Streamer already exists in this server"
}
return@action
}
}
if (arguments.role?.id == guild!!.id) {
respond {
content = "This action would implement a everyone ping, which is due to how role pings are implemented right now not possible. If you want to make an everyone ping regardless, make a role-less ping and write the everyone ping manually."
}
return@action
}
StreamerCollection().addData(
guild!!.id,
arguments.channel.id,
streamer,
@ -54,12 +67,63 @@ class StreamerCommand : Extension() {
}
action {
val streamer = arguments.streamer
StreamerCollection().removeData(guild!!.id, channel.id, streamer, null, null)
StreamerCollection().collection.findOne(StreamerData::name eq streamer)?.servers?.forEach {
StreamerCollection().removeData(it.guildId, it.channelId, streamer, it.roleId, it.liveMessage)
}
respond {
content = "Removed streamer $streamer"
}
}
}
publicSubCommand(::UpdateStreamerArgs) {
name = Translations.Streamer.Command.Update.name
description = Translations.Streamer.Command.Update.description
check {
anyGuild()
hasPermission(Permission.ManageGuild)
}
action {
val streamer = arguments.streamer
val data = StreamerCollection().collection.findOne(StreamerData::name eq streamer)
if (data != null) {
val servers = data.servers
val guildId = guild!!.id
val roleId = arguments.role
val channelId = arguments.channel
val message = arguments.message
val temp = servers.find { it.guildId == guildId }
if (roleId?.id== guildId) {
respond {
content = "This action would implement a everyone ping, which is due to how role pings are implemented right now not possible. If you want to make an everyone ping regardless, make a role-less ping and write the everyone ping manually."
}
return@action
}
if (temp != null) {
if (channelId != null) {
StreamerCollection().updateData(streamer, channelId.id, guildId)
}
if (roleId != null) {
StreamerCollection().updateData(streamer, roleId.id, guildId, false)
}
if (message != null) {
StreamerCollection().updateData(streamer, message, guildId)
}
respond {
content = "Updated streamer $streamer"
}
} else {
respond {
content = "No server associated with the guildId"
}
}
} else {
respond {
content = "No StreamerData associated with the streamerName"
}
}
}
}
}
}
@ -91,4 +155,23 @@ class StreamerCommand : Extension() {
require(true)
}
}
inner class UpdateStreamerArgs : Arguments() {
val streamer by string {
name = Translations.Streamer.Command.Arguments.Update.Streamer.name
description = Translations.Streamer.Command.Arguments.Update.Streamer.description
}
val channel by optionalChannel {
name = Translations.Streamer.Command.Arguments.Update.Channel.name
description = Translations.Streamer.Command.Arguments.Update.Channel.description
}
val role by optionalRole {
name = Translations.Streamer.Command.Arguments.Update.Role.name
description = Translations.Streamer.Command.Arguments.Update.Role.description
}
val message by optionalString {
name = Translations.Streamer.Command.Arguments.Update.Message.name
description = Translations.Streamer.Command.Arguments.Update.Message.description
}
}
}

View file

@ -0,0 +1,66 @@
package dev.jansel.feixiao.utils
import com.github.philippheuer.events4j.reactor.ReactorEventHandler
import com.github.twitch4j.TwitchClientBuilder
import com.github.twitch4j.events.ChannelGoLiveEvent
import dev.jansel.feixiao.botRef
import dev.jansel.feixiao.database.collections.StreamerCollection
import dev.jansel.feixiao.twitchClient
import dev.kord.core.entity.channel.GuildMessageChannel
import dev.kordex.core.koin.KordExKoinComponent
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
class Twitch : KordExKoinComponent {
suspend fun init() {
twitchClient = TwitchClientBuilder.builder()
.withEnableHelix(true)
.withDefaultEventHandler(ReactorEventHandler::class.java)
.withClientId(twitchcid)
.withClientSecret(twitchcs)
.build()
twitchClient!!.eventManager.onEvent(ChannelGoLiveEvent::class.java) {
dev.jansel.feixiao.logger.info { "${it.channel.name} went live!" }
runBlocking {
launch {
val streamer = StreamerCollection().getData(it.channel.name)
for (server in streamer!!.servers) {
val channel = botRef!!.kordRef.getChannelOf<GuildMessageChannel>(server.channelId)
val role = server.roleId
val livemessage = server.liveMessage
if (role != null) {
if (livemessage != null) {
channel?.createMessage(
livemessage
.replace("{name}", it.channel.name)
.replace("{category}", it.stream.gameName)
.replace("{title}", it.stream.title)
.replace("{url}", "https://twitch.tv/${it.channel.name}")
.replace("{role}", "<@&$role>")
)
} else {
channel?.createMessage("<@&$role> https://twitch.tv/${it.channel.name} went live streaming ${it.stream.gameName}: ${it.stream.title}")
}
} else {
if (livemessage != null) {
channel?.createMessage(
livemessage
.replace("{name}", it.channel.name)
.replace("{category}", it.stream.gameName)
.replace("{title}", it.stream.title)
.replace("{url}", "https://twitch.tv/${it.channel.name}")
)
} else {
channel?.createMessage("https://twitch.tv/${it.channel.name} went live streaming ${it.stream.gameName}: ${it.stream.title}")
}
}
}
}
}
}
}
}

View file

@ -3,6 +3,7 @@ package dev.jansel.feixiao.utils
import dev.jansel.feixiao.database.Database
import dev.jansel.feixiao.database.collections.MetaCollection
import dev.jansel.feixiao.database.collections.StreamerCollection
import dev.jansel.feixiao.twitchClient
import dev.kord.common.entity.Snowflake
import dev.kordex.core.builders.ExtensibleBotBuilder
import dev.kordex.core.utils.env
@ -37,3 +38,38 @@ suspend inline fun ExtensibleBotBuilder.database(migrate: Boolean) {
}
}
}
suspend inline fun ExtensibleBotBuilder.twitch(active: Boolean) {
hooks {
beforeKoinSetup {
loadModule {
single { Twitch() } bind Twitch::class
}
if (active) {
Twitch().init()
}
}
}
}
fun getTwitchNameById(id: String): String? {
val resultList = twitchClient!!.helix?.getUsers(null, listOf(id), null)?.execute()
resultList?.users?.forEach { user ->
if (user.id == id) {
return user.displayName
}
}
return null
}
fun getTwitchIdByName(name: String): String? {
val resultList = twitchClient!!.helix?.getUsers(null, null, listOf(name))?.execute()
resultList?.users?.forEach { user ->
if (user.displayName == name) {
return user.id
}
}
return null
}

View file

@ -2,10 +2,16 @@
streamer.command.name=streamer
streamer.command.description=A bundle of Streamer commands
streamer.command.add.name=add
streamer.command.add.description=Add a new streamer to the listener
streamer.command.remove.name=remove
streamer.command.remove.description=Remove a streamer from the listener
streamer.command.update.name=update
streamer.command.update.description=Update a streamer listener's settings for this guild
streamer.command.arguments.add.streamer.name=streamer
streamer.command.arguments.add.streamer.description=The streamer to add
streamer.command.arguments.add.channel.name=channel
@ -14,7 +20,19 @@ streamer.command.arguments.add.role.name=role
streamer.command.arguments.add.role.description=The role to assign to the streamer
streamer.command.arguments.add.message.name=message
streamer.command.arguments.add.message.description=Custom Announce message. Placeholders (in curly braces): url, name, title, category, role (if set)
streamer.command.arguments.remove.name=streamer
streamer.command.arguments.remove.description=The streamer to remove
streamer.command.arguments.update.streamer.name=streamer
streamer.command.arguments.update.streamer.description=The streamer to edit
streamer.command.arguments.update.channel.name=channel
streamer.command.arguments.update.channel.description=The channel to add the streamer to
streamer.command.arguments.update.role.name=role
streamer.command.arguments.update.role.description=The role to assign to the streamer
streamer.command.arguments.update.message.name=message
streamer.command.arguments.update.message.description=Custom Announce message. Placeholders (in curly braces): url, name, title, category, role (if set)
# more to come...