diff --git a/.gitignore b/.gitignore index eb93d1a..b5619f6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,8 @@ # Databases *.db - +*.db-shm +*.db-wal # Output of the go coverage tool, specifically when used with LiteIDE *.out diff --git a/go-bot/README.md b/go-bot/README.md new file mode 100644 index 0000000..84eb52e --- /dev/null +++ b/go-bot/README.md @@ -0,0 +1,8 @@ +# [!IMPORTANT] + +```/bin/sh +go build -tags goolm +``` + +Avoid compiling without using the goolm package. +[See](https://github.com/mautrix/go/issues/71) diff --git a/go-bot/go-bot b/go-bot/go-bot index 1983e62..2fe6490 100755 Binary files a/go-bot/go-bot and b/go-bot/go-bot differ diff --git a/go-bot/main.go b/go-bot/main.go index 957e44d..3d75b71 100644 --- a/go-bot/main.go +++ b/go-bot/main.go @@ -23,6 +23,7 @@ import ( "go.mau.fi/util/exzerolog" "maunium.net/go/mautrix" + "maunium.net/go/mautrix/crypto/cryptohelper" "maunium.net/go/mautrix/event" "maunium.net/go/mautrix/id" ) @@ -93,18 +94,20 @@ func main() { } } }) - - /*cryptoHelper, err := cryptohelper.NewCryptoHelper(client, []byte("meow"), *database) + // req = mautrix.ReqLogin() + // resp, err := client.Login(context.Background(), req*mautrix.ReqLogin) + // fmt.Println(resp, err) + cryptoHelper, err := cryptohelper.NewCryptoHelper(client, []byte("meow"), *database) if err != nil { panic(err) } - */ + // You can also store the user/device IDs and access token and put them in the client beforehand instead of using LoginAs. // client.UserID = "..." // client.DeviceID = "..." // client.AccessToken = "..." // You don't need to set a device ID in LoginAs because the crypto helper will set it for you if necessary. - /*cryptoHelper.LoginAs = &mautrix.ReqLogin{ + cryptoHelper.LoginAs = &mautrix.ReqLogin{ Type: mautrix.AuthTypePassword, Identifier: mautrix.UserIdentifier{Type: mautrix.IdentifierTypeUser, User: *username}, Password: *password, @@ -117,7 +120,6 @@ func main() { } // Set the client crypto helper in order to automatically encrypt outgoing messages client.Crypto = cryptoHelper - */ log.Info().Msg("Now running") syncCtx, cancelSync := context.WithCancel(context.Background()) var syncStopWait sync.WaitGroup