petyasoft / Blum

soft for @BlumCryptoBot
288 stars 51 forks source link

API Response to List Tasks Updated #40

Open farrelnajib opened 2 months ago

farrelnajib commented 2 months ago

I created a new account but this script doesn't do the tasks. When I printed the API response from https://game-domain.blum.codes/api/v1/tasks it looks like the response was updated to be like this

[
  {
    "tasks": [],
    "subSections": [
      {
        "title": "New",
        "tasks": [
          {
            "id": "e05bb747-7d40-4b69-8b99-0f4a9a9305cf",
            "kind": "INITIAL",
            "type": "SOCIAL_SUBSCRIPTION",
            "status": "NOT_STARTED",
            "validationType": "DEFAULT",
            "iconFileKey": "d72d558b-ce90-4e80-8dd8-109a134fe36a/c11fe842-e014-4ae2-94d7-f93e2cfd3ed5",
            "bannerFileKey": null,
            "title": "Bull & Bear 101",
            "productName": null,
            "description": null,
            "reward": "250",
            "socialSubscription": {
              "openInTelegram": false,
              "url": "https://youtu.be/MPK1DI0eddw"
            },
            "isHidden": false,
            "isDisclaimerRequired": false
          }
        ]
      },
      {
        "title": "OnChain",
        "tasks": [
          {
            "id": "39391eb2-f031-4954-bd8a-e7aecbb1f192",
            "kind": "INITIAL",
            "type": "WALLET_CONNECTION",
            "status": "FINISHED",
            "validationType": "DEFAULT",
            "iconFileKey": "e2b28ca7-366f-4a34-8448-8badc5f31c62/a84a75fd-5016-4486-a9a2-6e3912e62d43",
            "bannerFileKey": null,
            "title": "Connect ton wallet",
            "productName": null,
            "description": null,
            "reward": "0",
            "isHidden": false,
            "isDisclaimerRequired": false
          }
        ]
      },
      {
        "title": "Socials",
        "tasks": [
          {
            "id": "85f4eaf3-2200-4adf-8fea-c32362319919",
            "kind": "INITIAL",
            "type": "SOCIAL_SUBSCRIPTION",
            "status": "NOT_STARTED",
            "validationType": "DEFAULT",
            "iconFileKey": "e2b28ca7-366f-4a34-8448-8badc5f31c62/a84a75fd-5016-4486-a9a2-6e3912e62d43",
            "bannerFileKey": null,
            "title": "Follow Blum on Coinmarketcap",
            "productName": null,
            "description": null,
            "reward": "90",
            "socialSubscription": {
              "openInTelegram": false,
              "url": "https://coinmarketcap.com/community/profile/Blum/"
            },
            "isHidden": false,
            "isDisclaimerRequired": false
          }
        ]
      },
      {
        "title": "Academy",
        "tasks": [
          {
            "id": "e05bb747-7d40-4b69-8b99-0f4a9a9305cf",
            "kind": "INITIAL",
            "type": "SOCIAL_SUBSCRIPTION",
            "status": "NOT_STARTED",
            "validationType": "DEFAULT",
            "iconFileKey": "d72d558b-ce90-4e80-8dd8-109a134fe36a/c11fe842-e014-4ae2-94d7-f93e2cfd3ed5",
            "bannerFileKey": null,
            "title": "Bull & Bear 101",
            "productName": null,
            "description": null,
            "reward": "250",
            "socialSubscription": {
              "openInTelegram": false,
              "url": "https://youtu.be/MPK1DI0eddw"
            },
            "isHidden": false,
            "isDisclaimerRequired": false
          }
        ]
      },
      {
        "title": "Frens",
        "tasks": [
          {
            "id": "220ee7b1-cca4-4af8-838a-2001cb42b813",
            "kind": "ONGOING",
            "type": "PROGRESS_TARGET",
            "status": "NOT_STARTED",
            "validationType": "DEFAULT",
            "iconFileKey": "e2b28ca7-366f-4a34-8448-8badc5f31c62/a84a75fd-5016-4486-a9a2-6e3912e62d43",
            "bannerFileKey": null,
            "title": "Invite",
            "productName": null,
            "description": null,
            "reward": "200",
            "progressTarget": {
              "target": "10",
              "progress": "0",
              "accuracy": 0,
              "postfix": "frens"
            },
            "isHidden": false,
            "isDisclaimerRequired": false
          }
        ]
      },
      {
        "title": "Farming",
        "tasks": [
          {
            "id": "3b0ae076-9a85-4090-af55-d9f6c9463b2b",
            "kind": "ONGOING",
            "type": "PROGRESS_TARGET",
            "status": "NOT_STARTED",
            "validationType": "DEFAULT",
            "iconFileKey": "e2b28ca7-366f-4a34-8448-8badc5f31c62/a84a75fd-5016-4486-a9a2-6e3912e62d43",
            "bannerFileKey": null,
            "title": "Farm",
            "productName": null,
            "description": null,
            "reward": "300",
            "progressTarget": {
              "target": "10000",
              "progress": "57.6",
              "accuracy": 0,
              "postfix": "BP"
            },
            "isHidden": false,
            "isDisclaimerRequired": false
          }
        ]
      }
    ]
  }
]

We have to update the code from looping through tasks and then loop through subTasks, to loop through subSections and then loop through tasks