Got the bot example running.
This commit is contained in:
parent
7ebaacb689
commit
90bf87306d
4 changed files with 17 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
# Databases
|
||||
*.db
|
||||
|
||||
*.db-shm
|
||||
*.db-wal
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
|
|
|
|||
8
go-bot/README.md
Normal file
8
go-bot/README.md
Normal file
|
|
@ -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)
|
||||
BIN
go-bot/go-bot
BIN
go-bot/go-bot
Binary file not shown.
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue