Windows200000 / TwitchDropsMiner-updated

An app that allows you to AFK mine timed Twitch drops, with automatic drop claiming and channel switching.
MIT License
261 stars 16 forks source link

ZeroDivisionError: division by zero #101

Open gibbed opened 3 weeks ago

gibbed commented 3 weeks ago
11:42:55: Fatal error encountered:
11:42:55: 
11:42:55: Traceback (most recent call last):
11:42:55:   File "main.py", line 160, in main
11:42:55:   File "twitch.py", line 772, in run
11:42:55:   File "twitch.py", line 817, in _run
11:42:55:   File "twitch.py", line 1694, in fetch_inventory
11:42:55:   File "gui.py", line 1392, in add_campaign
11:42:55:   File "gui.py", line 1434, in update_progress
11:42:55:   File "functools.py", line 981, in __get__
11:42:55:   File "inventory.py", line 219, in progress
11:42:55: ZeroDivisionError: division by zero
gibbed commented 3 weeks ago

Appears to be related to the Twitch drops campaign "TFS Raid Contest Mode" for Destiny 2. One of the drops is "Subscribe to Redeem".

dogodogowoof commented 3 weeks ago

Getting the same too

image image

Windows200000 commented 3 weeks ago

Just happened to me. investigating...

Windows200000 commented 3 weeks ago

image It's this drop, that requires a subscription AND watching. I'l commit a fix, that will just ignore it, so you guys can keep using it and look into if there's some way of detecting that.

Windows200000 commented 3 weeks ago

Should just skip these that in the newest in_dev, that should be done by a workflow in about 3 minutes.

Yes, the fix that bad, but it would probably require manual cahnging of the settings file to prevent, as it would crash on startup. https://github.com/Windows200000/TwitchDropsMiner-updated/blob/e80fab9727e795a57af348c0948105101caebf02/inventory.py#L218-L224 I am looking into a cleaner way of handling that.

DarkViRnD commented 3 weeks ago

> 20:36:01: Fatal error encountered:
> 20:36:01: 
> 20:36:01: Traceback (most recent call last):
> 20:36:01:   File "main.py", line 160, in main
> 20:36:01:   File "twitch.py", line 772, in run
> 20:36:01:   File "twitch.py", line 817, in _run
> 20:36:01:   File "twitch.py", line 1643, in fetch_inventory
> 20:36:01:   File "twitch.py", line 1575, in gql_request
> 20:36:01: exceptions.MinerException: GQL error: [{'message': 'service error', 'path': ['currentUser', 'inventory', 'dropCampaignsInProgress']}]
> 20:36:01: 
> 20:36:01: Выход...

This is most likely a twitch problem. because I bought a subscription and my drops progress disappeared from my inventory.

Windows200000 commented 3 weeks ago

This might be all we get and it's not there :/

  {
     "id":"2eabb28b-22b9-11ef-8201-0a58a9feac02",
     "benefitEdges":[
        {
           "benefit":{
              "id":"3555708b-ff07-4392-a15b-bfae9356dfcf_CUSTOM_ID_wresttheheart_emblem_twitch_drop_reward",
              "createdAt":"2024-05-24T20:34:40.505Z",
              "entitlementLimit":1,
              "game":{
                 "id":"497057",
                 "name":"Destiny 2",
                 "__typename":"Game"
              },
              "imageAssetURL":"https://static-cdn.jtvnw.net/twitch-quests-assets/REWARD/daa90812-1d41-49ad-aa08-ac0d40d038e4.png",
              "isIosAvailable":false,
              "name":"Wrest the Heart",
              "ownerOrganization":{
                 "id":"3555708b-ff07-4392-a15b-bfae9356dfcf",
                 "name":"Bungie",
                 "__typename":"Organization"
              },
              "__typename":"DropBenefit"
           },
           "entitlementLimit":1,
           "__typename":"DropBenefitEdge"
        }
     ],
     "endAt":"2024-06-09T16:29:59.998Z",
     "name":"Wrest the Heart",
     "preconditionDrops":"None",
     "requiredMinutesWatched":0,
     "startAt":"2024-06-07T16:30:00Z",
     "__typename":"TimeBasedDrop"
  }

It is in the text description of the entire campaign, but that doesn't allow for easily determining what drop has the requirement.

gibbed commented 3 weeks ago
"requiredMinutesWatched":0,

Might be a way to ignore the drop?

Windows200000 commented 3 weeks ago
"requiredMinutesWatched":0,

Might be a way to ignore the drop?

Well I'm currently just setting preconditions_met to False, if remaining time is 0, but that var is intended for something else.

edit: u can see here: https://github.com/Windows200000/TwitchDropsMiner-updated/issues/101#issuecomment-2155236095

Windows200000 commented 3 weeks ago

This is all we get regarding the campaign from the "campaigns" GQL operation. Sadly, nothing seems to be here that would indicate this limitation. I might leave it at that for now and leave this issue open, in the hopes of someone finding something.

{
   "endAt":"2024-06-09T16:29:59.998Z",
   "description":"As a thanks for watching Destiny 2 during Raid Contest Mode, we will be giving away the never before released \"Stand In Salvation\" emblem when you watch for two hours. Additionally, subscribe to your favorite Destiny 2 streamer between June 7th @ 9:30AM PT - June 9th @ 9:30AM PT and receive the \"Wrest the Heart\" emblem! If you are already subscribed to your favorite streamer, you can also gift a sub to receive the emblem.  Please ensure that your Bungie account is linked to Twitch! ",
   "eventBasedDrops":[

   ],
   "detailsURL":"https://help.bungie.net/articles/8048011793812",
   "startAt":"2024-06-07T16:30:00Z",
   "timeBasedDrops":[
      {
         "id":"2eabb28b-22b9-11ef-8201-0a58a9feac02",
         "benefitEdges":[
            {
               "benefit":{
                  "id":"3555708b-ff07-4392-a15b-bfae9356dfcf_CUSTOM_ID_wresttheheart_emblem_twitch_drop_reward",
                  "createdAt":"2024-05-24T20:34:40.505Z",
                  "entitlementLimit":1,
                  "game":{
                     "id":"497057",
                     "name":"Destiny 2",
                     "__typename":"Game"
                  },
                  "imageAssetURL":"https://static-cdn.jtvnw.net/twitch-quests-assets/REWARD/daa90812-1d41-49ad-aa08-ac0d40d038e4.png",
                  "isIosAvailable":false,
                  "name":"Wrest the Heart",
                  "ownerOrganization":{
                     "id":"3555708b-ff07-4392-a15b-bfae9356dfcf",
                     "name":"Bungie",
                     "__typename":"Organization"
                  },
                  "__typename":"DropBenefit"
               },
               "entitlementLimit":1,
               "__typename":"DropBenefitEdge"
            }
         ],
         "endAt":"2024-06-09T16:29:59.998Z",
         "name":"Wrest the Heart",
         "preconditionDrops":"None",
         "requiredMinutesWatched":0,
         "startAt":"2024-06-07T16:30:00Z",
         "__typename":"TimeBasedDrop"
      },
      {
         "id":"5450d57b-22b9-11ef-a39d-0a58a9feac02",
         "benefitEdges":[
            {
               "benefit":{
                  "id":"3555708b-ff07-4392-a15b-bfae9356dfcf_CUSTOM_ID_standinsalvation_emblem_twitch_drop_reward",
                  "createdAt":"2024-05-24T20:37:45.061Z",
                  "entitlementLimit":1,
                  "game":{
                     "id":"497057",
                     "name":"Destiny 2",
                     "__typename":"Game"
                  },
                  "imageAssetURL":"https://static-cdn.jtvnw.net/twitch-quests-assets/REWARD/670f565b-3828-4e88-9964-a394fdf2d6f3.png",
                  "isIosAvailable":false,
                  "name":"Stand in Salvation",
                  "ownerOrganization":{
                     "id":"3555708b-ff07-4392-a15b-bfae9356dfcf",
                     "name":"Bungie",
                     "__typename":"Organization"
                  },
                  "__typename":"DropBenefit"
               },
               "entitlementLimit":1,
               "__typename":"DropBenefitEdge"
            }
         ],
         "endAt":"2024-06-09T16:29:59.998Z",
         "name":"Stand In Salvation",
         "preconditionDrops":"None",
         "requiredMinutesWatched":120,
         "startAt":"2024-06-07T16:30:00Z",
         "__typename":"TimeBasedDrop"
      }
   ],
   "status":"ACTIVE",
   "imageURL":"https://static-cdn.jtvnw.net/twitch-quests-assets/CAMPAIGN/4f8a844d-74e3-4b33-b758-48e9b15e0420.png",
   "id":"62fc70e3-22a3-11ef-8799-0a58a9feac02",
   "owner":{
      "id":"3555708b-ff07-4392-a15b-bfae9356dfcf",
      "name":"Bungie",
      "__typename":"Organization"
   },
   "name":"TFS Raid Contest Mode",
   "game":{
      "displayName":"Destiny 2",
      "id":"497057",
      "slug":"destiny-2",
      "__typename":"Game",
      "boxArtURL":"https://static-cdn.jtvnw.net/ttv-boxart/497057-120x160.jpg"
   },
   "__typename":"DropCampaign",
   "accountLinkURL":"https://www.bungie.net/LinkTwitch",
   "self":{
      "isAccountConnected":true,
      "__typename":"DropCampaignSelfEdge"
   },
   "allow":{
      "channels":"None",
      "isEnabled":false,
      "__typename":"DropCampaignACL"
   }
}
Windows200000 commented 3 weeks ago

New release with this "dirty" fix: v15.6.1

dogodogowoof commented 3 weeks ago

Thank for for the quick hotfix @Windows200000 . So far, it's working and holding <3