diff --git a/bot.ps1 b/bot.ps1 index ff055c8..ce585b1 100755 --- a/bot.ps1 +++ b/bot.ps1 @@ -432,13 +432,12 @@ function Get-FilterId { return $filter_id } function Start-MatrixSync { - #get last used next_batch from account_data - $token = Get-NextBatchToken - #get /sync filter $filter_id = Get-FilterId Try { + #get last used next_batch from account_data + $token = Get-NextBatchToken #try first sync with the old token $token = Invoke-MatrixSync -Token $token -FilterId $filter_id } Catch { @@ -447,9 +446,9 @@ function Start-MatrixSync { } while($true) { + $token = Invoke-MatrixSync -Token $token -FilterId $filter_id #use $token of the previous sync Set-NextBatchToken -Token $token - $token = Invoke-MatrixSync -Token $token -FilterId $filter_id } }