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
|
# Databases
|
||||||
*.db
|
*.db
|
||||||
|
*.db-shm
|
||||||
|
*.db-wal
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
*.out
|
*.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"
|
"go.mau.fi/util/exzerolog"
|
||||||
|
|
||||||
"maunium.net/go/mautrix"
|
"maunium.net/go/mautrix"
|
||||||
|
"maunium.net/go/mautrix/crypto/cryptohelper"
|
||||||
"maunium.net/go/mautrix/event"
|
"maunium.net/go/mautrix/event"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
)
|
)
|
||||||
|
|
@ -93,18 +94,20 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// req = mautrix.ReqLogin()
|
||||||
/*cryptoHelper, err := cryptohelper.NewCryptoHelper(client, []byte("meow"), *database)
|
// resp, err := client.Login(context.Background(), req*mautrix.ReqLogin)
|
||||||
|
// fmt.Println(resp, err)
|
||||||
|
cryptoHelper, err := cryptohelper.NewCryptoHelper(client, []byte("meow"), *database)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
// You can also store the user/device IDs and access token and put them in the client beforehand instead of using LoginAs.
|
// 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.UserID = "..."
|
||||||
// client.DeviceID = "..."
|
// client.DeviceID = "..."
|
||||||
// client.AccessToken = "..."
|
// client.AccessToken = "..."
|
||||||
// You don't need to set a device ID in LoginAs because the crypto helper will set it for you if necessary.
|
// 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,
|
Type: mautrix.AuthTypePassword,
|
||||||
Identifier: mautrix.UserIdentifier{Type: mautrix.IdentifierTypeUser, User: *username},
|
Identifier: mautrix.UserIdentifier{Type: mautrix.IdentifierTypeUser, User: *username},
|
||||||
Password: *password,
|
Password: *password,
|
||||||
|
|
@ -117,7 +120,6 @@ func main() {
|
||||||
}
|
}
|
||||||
// Set the client crypto helper in order to automatically encrypt outgoing messages
|
// Set the client crypto helper in order to automatically encrypt outgoing messages
|
||||||
client.Crypto = cryptoHelper
|
client.Crypto = cryptoHelper
|
||||||
*/
|
|
||||||
log.Info().Msg("Now running")
|
log.Info().Msg("Now running")
|
||||||
syncCtx, cancelSync := context.WithCancel(context.Background())
|
syncCtx, cancelSync := context.WithCancel(context.Background())
|
||||||
var syncStopWait sync.WaitGroup
|
var syncStopWait sync.WaitGroup
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue