Compare commits
10 Commits
858fbb73c1
...
60746f8824
| Author | SHA1 | Date | |
|---|---|---|---|
| 60746f8824 | |||
| dd358d2c13 | |||
| e4e3859277 | |||
| 8509ec9d33 | |||
| 3c98b8b9b7 | |||
| 8c5698f993 | |||
| 85a8ccb57d | |||
| a74a4d46ee | |||
| e0a3d165e1 | |||
| 7ff184720d |
@@ -4,8 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
|
||||||
- '**.go'
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -23,7 +21,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.24.x'
|
go-version: '1.25.x'
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: go mod download
|
run: go mod download
|
||||||
@@ -42,9 +40,9 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.24.x'
|
go-version: '1.25.x'
|
||||||
|
|
||||||
- name: Run golangci-lint
|
- name: Run golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v8
|
uses: golangci/golangci-lint-action@v8
|
||||||
with:
|
with:
|
||||||
version: 'v2.1'
|
version: 'v2.4'
|
||||||
|
|||||||
+3
-4
@@ -1,4 +1,3 @@
|
|||||||
.idea
|
/.idea/
|
||||||
vendor
|
/vendor/
|
||||||
bin
|
/docker-compose.override.yml
|
||||||
docker-compose.override.yml
|
|
||||||
|
|||||||
@@ -2,3 +2,69 @@ version: "2"
|
|||||||
|
|
||||||
run:
|
run:
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
|
issues-exit-code: 1
|
||||||
|
|
||||||
|
linters:
|
||||||
|
enable:
|
||||||
|
- errcheck
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- staticcheck
|
||||||
|
- unused
|
||||||
|
- bodyclose
|
||||||
|
- importas
|
||||||
|
- dogsled
|
||||||
|
- dupl
|
||||||
|
- gochecknoinits
|
||||||
|
- gocognit
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- revive
|
||||||
|
- gosec
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- prealloc
|
||||||
|
- unconvert
|
||||||
|
- whitespace
|
||||||
|
- rowserrcheck
|
||||||
|
- goconst
|
||||||
|
- asciicheck
|
||||||
|
- nestif
|
||||||
|
- copyloopvar
|
||||||
|
- sqlclosecheck
|
||||||
|
|
||||||
|
settings:
|
||||||
|
govet:
|
||||||
|
enable:
|
||||||
|
- shadow
|
||||||
|
|
||||||
|
gocritic:
|
||||||
|
disabled-checks:
|
||||||
|
- sloppyReassign
|
||||||
|
- whyNoLint
|
||||||
|
enabled-tags:
|
||||||
|
- experimental
|
||||||
|
- opinionated
|
||||||
|
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- std-error-handling
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
|||||||
@@ -10,14 +10,11 @@ Prerequisites:
|
|||||||
|
|
||||||
1. Git
|
1. Git
|
||||||
2. Docker
|
2. Docker
|
||||||
3. [bkit](https://github.com/nightnoryu/bkit)
|
3. [brewkit](https://github.com/ispringtech/brewkit)
|
||||||
|
|
||||||
Firstly, clone the repository into your `$GOPATH`:
|
Clone the repository:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mkdir -p $GOPATH/src/github.com/nightnoryu
|
|
||||||
cd $GOPATH/src/github.com/nightnoryu
|
|
||||||
|
|
||||||
git clone git@github.com:nightnoryu/anon3anon.git
|
git clone git@github.com:nightnoryu/anon3anon.git
|
||||||
cd anon3anon
|
cd anon3anon
|
||||||
```
|
```
|
||||||
@@ -25,7 +22,7 @@ cd anon3anon
|
|||||||
Then build the project:
|
Then build the project:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
bkit build
|
brewkit build
|
||||||
```
|
```
|
||||||
|
|
||||||
After that, copy the `docker-compose.override.example.yml` to `docker-compose.override.yml` and set the environment variables:
|
After that, copy the `docker-compose.override.example.yml` to `docker-compose.override.yml` and set the environment variables:
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
build:
|
|
||||||
dockerfile: docker/Dockerfile-amvera
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/anon3anon
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
gobuilder: "golang:1.24-alpine",
|
|
||||||
golangcilint: "golangci/golangci-lint:v2.1-alpine",
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
local project = import 'bkit/project.libsonnet';
|
local project = import 'brewkit/project.libsonnet';
|
||||||
|
|
||||||
local appIDs = [
|
local appIDs = [
|
||||||
"anon3anon",
|
"anon3anon",
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
gobuilder: "golang:1.25-alpine",
|
||||||
|
golangcilint: "golangci/golangci-lint:v2.4-alpine",
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ local gocache = [
|
|||||||
|
|
||||||
{
|
{
|
||||||
project(appIDs):: {
|
project(appIDs):: {
|
||||||
apiVersion: "bkit/v1",
|
apiVersion: "brewkit/v1",
|
||||||
|
|
||||||
targets: {
|
targets: {
|
||||||
all: ["modules", "build", "check"],
|
all: ["modules", "build", "check"],
|
||||||
@@ -3,6 +3,5 @@ services:
|
|||||||
container_name: anon3anon
|
container_name: anon3anon
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docker/Dockerfile-local
|
|
||||||
volumes:
|
volumes:
|
||||||
- "./bin:/app/bin"
|
- "./bin:/app/bin"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module github.com/nightnoryu/anon3anon
|
module github.com/nightnoryu/anon3anon
|
||||||
|
|
||||||
go 1.24
|
go 1.25
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-telegram/bot v1.15.0
|
github.com/go-telegram/bot v1.15.0
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ import (
|
|||||||
"github.com/go-telegram/bot/models"
|
"github.com/go-telegram/bot/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewAnonymousMessagesHandler(logger jsonlog.Logger, ownerChatId int) bot.HandlerFunc {
|
func NewAnonymousMessagesHandler(logger jsonlog.Logger, ownerChatID int) bot.HandlerFunc {
|
||||||
return func(ctx context.Context, b *bot.Bot, update *models.Update) {
|
return func(ctx context.Context, b *bot.Bot, update *models.Update) {
|
||||||
if update.Message == nil {
|
if update.Message == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ownerChatId == 0 {
|
if ownerChatID == 0 {
|
||||||
logger.Info(fmt.Sprintf("owner chat ID not set. set to %d to use the last chat", update.Message.Chat.ID))
|
logger.Info(fmt.Sprintf("owner chat ID not set. set to %d to use the last chat", update.Message.Chat.ID))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
params := &bot.CopyMessageParams{
|
params := &bot.CopyMessageParams{
|
||||||
ChatID: ownerChatId,
|
ChatID: ownerChatID,
|
||||||
FromChatID: update.Message.Chat.ID,
|
FromChatID: update.Message.Chat.ID,
|
||||||
MessageID: update.Message.ID,
|
MessageID: update.Message.ID,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func NewLoggingMiddleware(logger jsonlog.Logger) bot.Middleware {
|
|||||||
WithField(usernameField, update.Message.From.Username)
|
WithField(usernameField, update.Message.From.Username)
|
||||||
|
|
||||||
text := update.Message.Text
|
text := update.Message.Text
|
||||||
if len(update.Message.Caption) > 0 {
|
if update.Message.Caption != "" {
|
||||||
text = update.Message.Caption
|
text = update.Message.Caption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user