Save device ID

This commit is contained in:
Luca 2022-07-24 23:44:04 +02:00
parent 8e608f0f17
commit a18353b531
1 changed files with 4 additions and 1 deletions

View File

@ -56,7 +56,7 @@ func NewClient(config *config.MatrixConfig, db *sql.DB) (*Client, error) {
func (c *Client) Login() error { func (c *Client) Login() error {
c.syncer.OnEventType(event.StateMember, c.handleMemberEvent) c.syncer.OnEventType(event.StateMember, c.handleMemberEvent)
_, err := c.client.Login(&mautrix.ReqLogin{ resp, err := c.client.Login(&mautrix.ReqLogin{
Type: mautrix.AuthTypePassword, Type: mautrix.AuthTypePassword,
Identifier: mautrix.UserIdentifier{ Identifier: mautrix.UserIdentifier{
Type: mautrix.IdentifierTypeUser, Type: mautrix.IdentifierTypeUser,
@ -71,6 +71,9 @@ func (c *Client) Login() error {
return err return err
} }
c.deviceID = resp.DeviceID
log.Print("device ID: ", c.deviceID)
return nil return nil
} }