Compare commits

..

No commits in common. "f56a7a3266e2e00e3c079f39968225224f356086" and "2c17ef58fa98646a0bac6d01ef36b69d5219d049" have entirely different histories.

13 changed files with 184 additions and 118 deletions

View file

@ -1,7 +1,7 @@
name: CI Workflow name: CI Workflow
on: push on: push
permissions: permissions:
contents: read packages: write
jobs: jobs:
doc-generator: doc-generator:
if: ${{ startsWith(github.ref, 'refs/tags/v') }} if: ${{ startsWith(github.ref, 'refs/tags/v') }}
@ -11,7 +11,7 @@ jobs:
run: run:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -21,11 +21,18 @@ jobs:
id-token: write id-token: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install required packages
run: |
pacman -Syy --noconfirm \
curl \
git \
git-lfs \
make \
tar
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true lfs: true
show-progress: false show-progress: false
submodules: true
- name: Marking workdir safe - name: Marking workdir safe
run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot
- name: Generate documentation - name: Generate documentation
@ -43,12 +50,11 @@ jobs:
defaults: defaults:
run: run:
shell: bash shell: bash
permissions:
packages: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true
show-progress: false show-progress: false
- name: Log into registry - name: Log into registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@ -66,7 +72,7 @@ jobs:
run: run:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -74,12 +80,16 @@ jobs:
services: services:
crdb: crdb:
image: luzifer/crdb-gh-service image: luzifer/crdb-gh-service
options: --health-cmd "curl -sSf http://localhost:8080/health" --health-interval 10s --health-timeout 5s --health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages - name: Install required packages
run: | run: |
pacman -Syy --noconfirm \ pacman -Syy --noconfirm \
cockroachdb-bin cockroachdb-bin \
git \
go \
make
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
show-progress: false show-progress: false
@ -105,7 +115,7 @@ jobs:
run: run:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -117,11 +127,15 @@ jobs:
MYSQL_PASSWORD: twitch-bot-pass MYSQL_PASSWORD: twitch-bot-pass
MYSQL_ROOT_PASSWORD: root-pass MYSQL_ROOT_PASSWORD: root-pass
MYSQL_USER: twitch-bot MYSQL_USER: twitch-bot
options: --health-cmd "healthcheck.sh --connect --innodb_initialized" --health-interval 10s --health-timeout 5s --health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages - name: Install required packages
run: | run: |
pacman -Syy --noconfirm \ pacman -Syy --noconfirm \
git \
go \
make \
mariadb-clients mariadb-clients
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -147,7 +161,7 @@ jobs:
run: run:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -159,11 +173,15 @@ jobs:
MYSQL_PASSWORD: twitch-bot-pass MYSQL_PASSWORD: twitch-bot-pass
MYSQL_ROOT_PASSWORD: root-pass MYSQL_ROOT_PASSWORD: root-pass
MYSQL_USER: twitch-bot MYSQL_USER: twitch-bot
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages - name: Install required packages
run: | run: |
pacman -Syy --noconfirm \ pacman -Syy --noconfirm \
git \
go \
make \
mariadb-clients mariadb-clients
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -189,7 +207,7 @@ jobs:
run: run:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -199,8 +217,15 @@ jobs:
image: postgres:15 image: postgres:15
env: env:
POSTGRES_PASSWORD: twitch-bot-pass POSTGRES_PASSWORD: twitch-bot-pass
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages
run: |
pacman -Syy --noconfirm \
git \
go \
make
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
show-progress: false show-progress: false
@ -219,16 +244,35 @@ jobs:
run: run:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
permissions:
contents: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages
run: |
pacman -Syy --noconfirm \
awk \
curl \
diffutils \
git \
git-lfs \
go \
golangci-lint-bin \
make \
nodejs-lts-hydrogen \
npm \
tar \
trivy \
unzip \
which \
zip
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true
show-progress: false show-progress: false
- name: Marking workdir safe - name: Marking workdir safe
run: | run: |
@ -238,11 +282,13 @@ jobs:
- name: Extract changelog - name: Extract changelog
run: awk "/^#/ && ++c==2{exit}; /^#/f" "History.md" | tail -n +2 >release_changelog.md run: awk "/^#/ && ++c==2{exit}; /^#/f" "History.md" | tail -n +2 >release_changelog.md
- name: Update stable branch - name: Update stable branch
if: startsWith(github.ref, 'refs/tags/')
run: | run: |
git branch -f stable ${GITHUB_SHA} git branch -f stable ${GITHUB_SHA}
git push -f origin stable git push -f origin stable
- name: Release - name: Release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with: with:
artifacts: .build/* artifacts: .build/*
bodyFile: release_changelog.md bodyFile: release_changelog.md
@ -254,14 +300,35 @@ jobs:
run: run:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages
run: |
pacman -Syy --noconfirm \
awk \
curl \
diffutils \
git \
git-lfs \
go \
golangci-lint-bin \
make \
nodejs-lts-hydrogen \
npm \
tar \
trivy \
unzip \
which \
zip
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true
show-progress: false show-progress: false
- name: Marking workdir safe - name: Marking workdir safe
run: | run: |

View file

@ -1,66 +1,3 @@
# 3.29.2 / 2024-04-13
> [!IMPORTANT]
> This release introduces a new configuration validation which might lead to your bot not starting as of stronger type checking of actor settings. To validate the config is fine run a validation against the config once before replacing the bot binary / Docker image:
>
> `./twitch-bot --storage-conn-string "file::memory:?cache=shared" -c path/to/config.yaml validate-config`
>
> Using the connection string shown above will use a non-persistent database and can be used while the existing bot is running.
* New Features
* [eventsub] Add support for suspicious user events
* Improvements
* [core] Enforce attribute type schema validation on config
* [core] Remove deprecated fallback token / token migration
* [counter] Allow `counterTopList` to specify how to sort
* [counter] Record first seen and last updated on counters
* [counter] Revise template parsing logic
* [docs] Add field-type annotations to events
* [spotify] Improve error handling / documentation
* [spotify] Switch to PKCE flow, remove need for clientSecret
* Bugfixes
* [core] Fix: Do not retry core-kv query when it's not set
* [core] Fix: Don't initialize twitch client before start checks
* [eventsub] Fix: Fetching existing subscriptions broken
> [!NOTE]
> In case you're using the DockerHub Docker images and rely on the presence of the `stable` tag please switch to the [Github Registry](https://github.com/Luzifer/twitch-bot/pkgs/container/twitch-bot) and use the `latest` tag. Development releases are published as `develop`. The `stable` tag will not be updated beyond `v3.28.1`, DockerHub images are currently still supported but will be faded out.
> [!NOTE]
> Re-release of v3.29.0 as of broken tests in that release, no functional changes.
# 3.29.0 / 2024-04-13
> [!IMPORTANT]
> This release introduces a new configuration validation which might lead to your bot not starting as of stronger type checking of actor settings. To validate the config is fine run a validation against the config once before replacing the bot binary / Docker image:
>
> `./twitch-bot --storage-conn-string "file::memory:?cache=shared" -c path/to/config.yaml validate-config`
>
> Using the connection string shown above will use a non-persistent database and can be used while the existing bot is running.
* New Features
* [eventsub] Add support for suspicious user events
* Improvements
* [core] Enforce attribute type schema validation on config
* [core] Remove deprecated fallback token / token migration
* [counter] Allow `counterTopList` to specify how to sort
* [counter] Record first seen and last updated on counters
* [counter] Revise template parsing logic
* [docs] Add field-type annotations to events
* [spotify] Improve error handling / documentation
* [spotify] Switch to PKCE flow, remove need for clientSecret
* Bugfixes
* [core] Fix: Do not retry core-kv query when it's not set
* [core] Fix: Don't initialize twitch client before start checks
* [eventsub] Fix: Fetching existing subscriptions broken
> [!NOTE]
> In case you're using the DockerHub Docker images and rely on the presence of the `stable` tag please switch to the [Github Registry](https://github.com/Luzifer/twitch-bot/pkgs/container/twitch-bot) and use the `latest` tag. Development releases are published as `develop`. The `stable` tag will not be updated beyond `v3.28.1`, DockerHub images are currently still supported but will be faded out.
# 3.28.1 / 2024-04-02 # 3.28.1 / 2024-04-02
* New Features * New Features

View file

@ -36,7 +36,7 @@ frontend_lint: node_modules
src src
node_modules: node_modules:
npm ci --include dev npm ci
# --- Tools # --- Tools

View file

@ -2,6 +2,6 @@ name: CI Workflow
on: push on: push
permissions: permissions:
contents: read packages: write
jobs: {} jobs: {}

View file

@ -8,7 +8,7 @@ defaults:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -21,11 +21,20 @@ permissions:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Install required packages
run: |
pacman -Syy --noconfirm \
curl \
git \
git-lfs \
make \
tar
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true lfs: true
show-progress: false show-progress: false
submodules: true
- name: Marking workdir safe - name: Marking workdir safe
run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot

View file

@ -7,14 +7,12 @@ defaults:
run: run:
shell: bash shell: bash
permissions:
packages: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true
show-progress: false show-progress: false
- name: Log into registry - name: Log into registry

View file

@ -8,7 +8,7 @@ defaults:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -18,17 +18,18 @@ runs-on: ubuntu-latest
services: services:
crdb: crdb:
image: luzifer/crdb-gh-service image: luzifer/crdb-gh-service
options: >-
--health-cmd "curl -sSf http://localhost:8080/health"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages - name: Install required packages
run: | run: |
pacman -Syy --noconfirm \ pacman -Syy --noconfirm \
cockroachdb-bin cockroachdb-bin \
git \
go \
make
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:

View file

@ -8,7 +8,7 @@ defaults:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -22,16 +22,17 @@ services:
MYSQL_PASSWORD: twitch-bot-pass MYSQL_PASSWORD: twitch-bot-pass
MYSQL_ROOT_PASSWORD: root-pass MYSQL_ROOT_PASSWORD: root-pass
MYSQL_USER: twitch-bot MYSQL_USER: twitch-bot
options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages - name: Install required packages
run: | run: |
pacman -Syy --noconfirm \ pacman -Syy --noconfirm \
git \
go \
make \
mariadb-clients mariadb-clients
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View file

@ -8,7 +8,7 @@ defaults:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -22,16 +22,17 @@ services:
MYSQL_PASSWORD: twitch-bot-pass MYSQL_PASSWORD: twitch-bot-pass
MYSQL_ROOT_PASSWORD: root-pass MYSQL_ROOT_PASSWORD: root-pass
MYSQL_USER: twitch-bot MYSQL_USER: twitch-bot
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages - name: Install required packages
run: | run: |
pacman -Syy --noconfirm \ pacman -Syy --noconfirm \
git \
go \
make \
mariadb-clients mariadb-clients
- uses: actions/checkout@v4 - uses: actions/checkout@v4

View file

@ -8,7 +8,7 @@ defaults:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -20,13 +20,18 @@ services:
image: postgres:15 image: postgres:15
env: env:
POSTGRES_PASSWORD: twitch-bot-pass POSTGRES_PASSWORD: twitch-bot-pass
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages
run: |
pacman -Syy --noconfirm \
git \
go \
make
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
show-progress: false show-progress: false

View file

@ -8,19 +8,39 @@ defaults:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
permissions:
contents: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages
run: |
pacman -Syy --noconfirm \
awk \
curl \
diffutils \
git \
git-lfs \
go \
golangci-lint-bin \
make \
nodejs-lts-hydrogen \
npm \
tar \
trivy \
unzip \
which \
zip
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true
show-progress: false show-progress: false
- name: Marking workdir safe - name: Marking workdir safe
@ -34,12 +54,14 @@ steps:
run: 'awk "/^#/ && ++c==2{exit}; /^#/f" "History.md" | tail -n +2 >release_changelog.md' run: 'awk "/^#/ && ++c==2{exit}; /^#/f" "History.md" | tail -n +2 >release_changelog.md'
- name: Update stable branch - name: Update stable branch
if: startsWith(github.ref, 'refs/tags/')
run: | run: |
git branch -f stable ${GITHUB_SHA} git branch -f stable ${GITHUB_SHA}
git push -f origin stable git push -f origin stable
- name: Release - name: Release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with: with:
artifacts: '.build/*' artifacts: '.build/*'
bodyFile: release_changelog.md bodyFile: release_changelog.md

View file

@ -7,7 +7,7 @@ defaults:
shell: bash shell: bash
container: container:
image: luzifer/gh-arch-env image: luzifer/archlinux
env: env:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOPATH: /go GOPATH: /go
@ -15,8 +15,31 @@ container:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Enable custom AUR package repo
run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf
- name: Install required packages
run: |
pacman -Syy --noconfirm \
awk \
curl \
diffutils \
git \
git-lfs \
go \
golangci-lint-bin \
make \
nodejs-lts-hydrogen \
npm \
tar \
trivy \
unzip \
which \
zip
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
lfs: true
show-progress: false show-progress: false
- name: Marking workdir safe - name: Marking workdir safe

View file

@ -234,6 +234,7 @@ func (t *twitchWatcher) getTopicRegistrations(userID string) []topicRegistration
}, },
{ {
Topic: twitch.EventSubEventTypeChannelSuspiciousUserMessage, Topic: twitch.EventSubEventTypeChannelSuspiciousUserMessage,
Version: twitch.EventSubTopicVersionBeta,
Condition: twitch.EventSubCondition{BroadcasterUserID: userID, ModeratorUserID: userID}, Condition: twitch.EventSubCondition{BroadcasterUserID: userID, ModeratorUserID: userID},
RequiredScopes: []string{twitch.ScopeModeratorReadSuspiciousUsers}, RequiredScopes: []string{twitch.ScopeModeratorReadSuspiciousUsers},
Hook: t.handleEventSubSusUserMessage, Hook: t.handleEventSubSusUserMessage,
@ -241,6 +242,7 @@ func (t *twitchWatcher) getTopicRegistrations(userID string) []topicRegistration
}, },
{ {
Topic: twitch.EventSubEventTypeChannelSuspiciousUserUpdate, Topic: twitch.EventSubEventTypeChannelSuspiciousUserUpdate,
Version: twitch.EventSubTopicVersionBeta,
Condition: twitch.EventSubCondition{BroadcasterUserID: userID, ModeratorUserID: userID}, Condition: twitch.EventSubCondition{BroadcasterUserID: userID, ModeratorUserID: userID},
RequiredScopes: []string{twitch.ScopeModeratorReadSuspiciousUsers}, RequiredScopes: []string{twitch.ScopeModeratorReadSuspiciousUsers},
Hook: t.handleEventSubSusUserUpdate, Hook: t.handleEventSubSusUserUpdate,