fix home server issue

This commit is contained in:
iacore 2024-01-21 18:50:27 +00:00
parent 5f3505dcb0
commit fae69c4d1a
Signed by: iacore
GPG key ID: F8C16E5157A63006
2 changed files with 7 additions and 1 deletions

View file

@ -16,6 +16,7 @@ type MatrixConfig struct {
// In element.io, find it under Settings -> About & Help -> Advanced.
AccessToken string
RoomId string
HomeServer string
}
type MatrixClient struct {
@ -31,7 +32,11 @@ func NewMatrixClient(config MatrixConfig) (*MatrixClient, error) {
}
user_id := UserID(config.UserId)
client, err := m.NewClient(user_id.Homeserver(), user_id, config.AccessToken)
homeserver := config.HomeServer
if homeserver == "" {
homeserver = user_id.Homeserver()
}
client, err := m.NewClient(homeserver, user_id, config.AccessToken)
if err != nil {
return nil, err
}

View file

@ -13,3 +13,4 @@ service = [
userId = "@exozymebot76397:matrix.org"
# accessToken = "nil"
roomId = "!fXEYZcqHcbjztwNhhD:exozy.me"
homeserver = "https://chat.exozy.me"