1
0
mirror of https://github.com/pinpox/gitea-matrix-bot synced 2024-11-22 19:31:58 +01:00

Fix bug in config

This commit is contained in:
Pablo Ovelleiro Corral 2023-07-13 18:29:50 +02:00
parent 740048e8cf
commit 7589a78e2e
No known key found for this signature in database
GPG Key ID: 29E9A6ED72CCB334
6 changed files with 14 additions and 13 deletions

@ -1,17 +1,17 @@
[![Build Status](https://travis-ci.org/binaryplease/gitea-matrix-bot.svg?branch=master)](https://travis-ci.org/binaryplease/gitea-matrix-bot) [![Build Status](https://travis-ci.org/pinpox/gitea-matrix-bot.svg?branch=master)](https://travis-ci.org/pinpox/gitea-matrix-bot)
[![GoDoc](https://godoc.org/github.com/binaryplease/gitea-matrix-bot?status.svg)](https://godoc.org/github.com/binaryplease/gitea-matrix-bot) [![GoDoc](https://godoc.org/github.com/pinpox/gitea-matrix-bot?status.svg)](https://godoc.org/github.com/pinpox/gitea-matrix-bot)
[![Go Report Card](https://goreportcard.com/badge/github.com/binaryplease/gitea-matrix-bot)](https://goreportcard.com/report/github.com/binaryplease/gitea-matrix-bot) [![Go Report Card](https://goreportcard.com/badge/github.com/pinpox/gitea-matrix-bot)](https://goreportcard.com/report/github.com/pinpox/gitea-matrix-bot)
[![codecov](https://codecov.io/gh/binaryplease/gitea-matrix-bot/branch/master/graph/badge.svg)](https://codecov.io/gh/binaryplease/gitea-matrix-bot) [![codecov](https://codecov.io/gh/pinpox/gitea-matrix-bot/branch/master/graph/badge.svg)](https://codecov.io/gh/pinpox/gitea-matrix-bot)
![Matrix](https://img.shields.io/matrix/gitea-matrix-bot:matrix.org.svg?label=%23gitea-matrix-bot%3Amatrix.org) ![Matrix](https://img.shields.io/matrix/gitea-matrix-bot:matrix.org.svg?label=%23gitea-matrix-bot%3Amatrix.org)
# gitea-matrix-bot # gitea-matrix-bot
A bot to listen for [gitea](https://gitea.io) webhooks and post to a [matrix](https://matrix.org) channel A bot to listen for [gitea](https://gitea.io) webhooks and post to a [matrix](https://matrix.org) channel
<p align="center"> <p align="center">
<img src="https://github.com/binaryplease/gitea-matrix-bot/raw/master/logo.png" width="300" height="300" /> <img src="https://github.com/pinpox/gitea-matrix-bot/raw/master/logo.png" width="300" height="300" />
</p> </p>
This bot was build using my [bot framework](https://github.com/binaryplease/matrix-bot/). If you stumble upon bugs on any of them please let me know! This bot was build using my [bot framework](https://github.com/pinpox/matrix-bot/). If you stumble upon bugs on any of them please let me know!
##### Status ##### Status

@ -32,7 +32,7 @@
version = "master"; version = "master";
src = ./.; src = ./.;
vendorSha256 = vendorSha256 =
"sha256-Kce1ky4orC8pPSEUAbOeW/O2S4ThtOLdYIPaXfKGHA4="; "sha256-4g/pUJ0gGYj6Y3rDINZBbcrEwloA5QCLdviECB1QrIQ=";
# TODO fix tests # TODO fix tests
doCheck = false; doCheck = false;

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"strings" "strings"
matrixbot "github.com/binaryplease/matrix-bot" matrixbot "github.com/pinpox/matrix-bot"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@ -20,10 +20,11 @@ type GiteaBot struct {
// NewGiteaBot creates a new bot form user credentials // NewGiteaBot creates a new bot form user credentials
func NewGiteaBot(user, pass, host string, DBPath string) *GiteaBot { func NewGiteaBot(user, pass, host string, DBPath string) *GiteaBot {
log.Info("Creating bot")
bot, err := matrixbot.NewMatrixBot(user, pass, host, "gitea") bot, err := matrixbot.NewMatrixBot(user, pass, host, "gitea")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal("Failed to create bot", err)
} }
db := NewGiteaDB(DBPath) db := NewGiteaDB(DBPath)

2
go.mod

@ -4,9 +4,9 @@ go 1.20
require ( require (
github.com/alecthomas/kingpin/v2 v2.3.2 github.com/alecthomas/kingpin/v2 v2.3.2
github.com/binaryplease/matrix-bot v0.0.0-20190422182545-e58f16f86ca7
github.com/go-ini/ini v1.67.0 github.com/go-ini/ini v1.67.0
github.com/mattn/go-sqlite3 v1.14.17 github.com/mattn/go-sqlite3 v1.14.17
github.com/pinpox/matrix-bot v0.0.0-20190422182545-e58f16f86ca7
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.3
) )

4
go.sum

@ -2,8 +2,6 @@ github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWr
github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/binaryplease/matrix-bot v0.0.0-20190422182545-e58f16f86ca7 h1:DaAe5WJc6OZlwBICe1nXU2qqZZ3Pfo8ueQKjz+UE5ls=
github.com/binaryplease/matrix-bot v0.0.0-20190422182545-e58f16f86ca7/go.mod h1:OoTSJ08SgAIAZFhlnq7/yx3QFUwlZChDCV5LTREdtMc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -13,6 +11,8 @@ github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s= github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/pinpox/matrix-bot v0.0.0-20190422182545-e58f16f86ca7 h1:XHreELSalICD7W0epPMaipBJNavXLYMnKoF3HlHdsRw=
github.com/pinpox/matrix-bot v0.0.0-20190422182545-e58f16f86ca7/go.mod h1:7Rr0lMai8JyXMw8rlLclHmIX0+Lf7GJcfEL4R9/Wtk4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=

@ -48,7 +48,7 @@ func init() {
matrixUser := cfg.Section("matrix").Key("matrix_user").String() matrixUser := cfg.Section("matrix").Key("matrix_user").String()
matrixPass := cfg.Section("matrix").Key("matrix_pass").String() matrixPass := cfg.Section("matrix").Key("matrix_pass").String()
matrixHost := cfg.Section("matrix").Key("matrix_pass").String() matrixHost := cfg.Section("matrix").Key("matrix_host").String()
dbPath := cfg.Section("bot").Key("db_path").String() dbPath := cfg.Section("bot").Key("db_path").String()
//Set up the bot //Set up the bot