configure processing invites

This commit is contained in:
Erik Winter 2023-06-18 09:26:41 +02:00
parent 168eb0a9d2
commit 73aea70f5c
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,7 @@ type MatrixConfig struct {
RoomID string RoomID string
DBPath string DBPath string
Pickle string Pickle string
AcceptInvites bool
} }
type Matrix struct { type Matrix struct {
@ -60,7 +61,9 @@ func (m *Matrix) Init() error {
} }
m.client.Crypto = m.cryptoHelper m.client.Crypto = m.cryptoHelper
if m.config.AcceptInvites {
m.AddEventHandler(m.InviteHandler()) m.AddEventHandler(m.InviteHandler())
}
return nil return nil
} }

View File

@ -33,6 +33,7 @@ func main() {
RoomID: getParam("MATRIX_ROOM_ID", "!room:localhost"), RoomID: getParam("MATRIX_ROOM_ID", "!room:localhost"),
DBPath: getParam("MATRIX_DB_PATH", "matrix.db"), DBPath: getParam("MATRIX_DB_PATH", "matrix.db"),
Pickle: getParam("MATRIX_PICKLE", "matrix.pickle"), Pickle: getParam("MATRIX_PICKLE", "matrix.pickle"),
AcceptInvites: getParam("MATRIX_ACCEPT_INVITES", "false") == "true",
} }
mtrx := bot.NewMatrix(mtrxConf, mflx, logger) mtrx := bot.NewMatrix(mtrxConf, mflx, logger)
if err := mtrx.Init(); err != nil { if err := mtrx.Init(); err != nil {