File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ internal sealed class Bot {
6060 [ JsonProperty ]
6161 private readonly CardsFarmer CardsFarmer ;
6262
63+ private readonly ConcurrentHashSet < ulong > HandledGifts = new ConcurrentHashSet < ulong > ( ) ;
6364 private readonly SteamApps SteamApps ;
6465 private readonly SteamFriends SteamFriends ;
6566 private readonly SteamUser SteamUser ;
@@ -1517,6 +1518,7 @@ private async void OnDisconnected(SteamClient.DisconnectedCallback callback) {
15171518
15181519 FirstTradeSent = false ;
15191520 CardsFarmer . StopFarming ( ) . Forget ( ) ;
1521+ HandledGifts . ClearAndTrim ( ) ;
15201522
15211523 // If we initiated disconnect, do not attempt to reconnect
15221524 if ( callback . UserInitiated ) {
@@ -1573,10 +1575,11 @@ private async void OnGuestPassList(SteamApps.GuestPassListCallback callback) {
15731575 }
15741576
15751577 bool acceptedSomething = false ;
1576- foreach ( ulong gid in callback . GuestPasses . Select ( guestPass => guestPass [ "gid" ] . AsUnsignedLong ( ) ) . Where ( gid => gid != 0 ) ) {
1578+ foreach ( ulong gid in callback . GuestPasses . Select ( guestPass => guestPass [ "gid" ] . AsUnsignedLong ( ) ) . Where ( gid => ( gid != 0 ) && ! HandledGifts . Contains ( gid ) ) ) {
15771579 Logging . LogGenericInfo ( "Accepting gift: " + gid + "..." , BotName ) ;
15781580 if ( await ArchiWebHandler . AcceptGift ( gid ) . ConfigureAwait ( false ) ) {
15791581 acceptedSomething = true ;
1582+ HandledGifts . Add ( gid ) ;
15801583 Logging . LogGenericInfo ( "Success!" , BotName ) ;
15811584 } else {
15821585 Logging . LogGenericInfo ( "Failed!" , BotName ) ;
You can’t perform that action at this time.
0 commit comments