Giter Club home page Giter Club logo

hoyolab-auto's Introduction

torikushiii 🔭

Hi there 👋

⚡ A person who is passionate about technologies, open-source, reverse engineering, convenience, etc.

  • en-US / jp-JP
  • Programmer / Developer
  • Likes to collect stuff

🌱 Programming Languages

HTML5 Astro JavaScript Java Node.js Python PHP Go

💰 Buy me a Coffee

✨ If you like my projects, you can buy me a coffee at:

💻 Working Environment

Windows 11 Pro Workstation 22H2 Windows Server 2022 Datacenter 21H2 Ubuntu 22.04.1 Android 14 Upside Down Cake iOS 17.2.1

👯 Some of my projects:

hoyolab-auto's People

Contributors

abigailwillow avatar flamingfox911 avatar sealldeveloper avatar torikushiii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hoyolab-auto's Issues

Dailies Reminder, Check-in and Expedition [ZZZ]

  1. Expeditions are not supported, it seems.
    image
  2. Is it normal behavior that a daily reminder reminds you even when all the daily tasks are completed? According to starrail-auto, I remember that the notification came only in the case when it was not done by the time of the reminder
    image
  3. Shouldn't there be a notification that if the check-in has already been performed today, then send this notification, and not just write about it in the logs?
    image

[Genshin Impact] Redemption code

Please check if variable which is used for codes can contain the "longer" strings.
Few minutes ago I got notification that script was unable to redeem the code:
https://genshin.hoyoverse.com/en/gift?code=GENSHINSUMMERNI
but the real code is:
https://genshin.hoyoverse.com/en/gift?code=GENSHINSUMMERNIGHT

Maybe it was cut as variable with code is set to 15 characters max?

  • I got an error on the console:
2024-07-17 15:15:04 <INFO:CodeRedeem:Genshin> {
  message: 'Genshin API returned non-zero status code',
  args: {
    retcode: -1071,
    message: {
      data: null,
      message: 'Please log in to your account first',
      retcode: -1071
    }
  }
}

Which is strange as I'm logged in (according to the script startup log).

Get more detail Google Script

Can I possibly get the UID and name from this API? Do you have the documentation for the API? I think I can improve it.

ZZZ Cookie does not contain account_id_v2 and cookie_token_v2

ZZZ Cookie does not contain account_id_v2 and cookie_token_v2. Adding them manually does not solve the problem.

WARN:HoyoLab No cookie_token_v2 or account_mid_v2 found in cookie for nap. This will disable "redeemCode" functionality.

I suggest to add option to read config in old way as an additional functionality.

			cookie: {
				token: "", // cookie_token_v2
				mid: "", // account_mid_v2
				ltuid: "" // ltuid_v2
			},

fatal: not a git repository (or any of the parent directories): .git

I am using Docker for this project. If I do not include the following command in the Dockerfile:RUN apk add --no-cache git
I get the error:/bin/sh: git: not found
If I add the command, the error changes to:hoyolab-auto | fatal: not a git repository (or any of the parent directories): .git

edit:
I re-cloned the project and added RUN apk add --no-cache git. For now, there haven't been any errors. Also, I want to ask whether the redemption code will automatically redeem the known codes the first time it runs, or will it only redeem new codes thereafter?

Running this on mac

I managed to install Git and Node.js, but running npm install gives me:

jason@Jasons-MacBook ~ % npm install
npm error code EEXIST
npm error syscall mkdir
npm error path /Users/jason/.npm/_cacache/content-v2/sha512/a6/58
npm error errno EEXIST
npm error Invalid response body while trying to fetch https://registry.npmjs.org/graphemer: EACCES: permission denied, mkdir '/Users/jason/.npm/_cacache/content-v2/sha512/a6/58'
npm error File exists: /Users/jason/.npm/_cacache/content-v2/sha512/a6/58
npm error Remove the existing file and try again, or run npm
npm error with --force to overwrite files recklessly.
npm error A complete log of this run can be found in: /Users/jason/.npm/_logs/2024-07-07T09_55_11_511Z-debug-0.log

this is after I copied the 'package.json' file over to User>jason, since the previous error was

jason@Jasons-MacBook ~ % npm install
npm error code ENOENT
npm error syscall open
npm error path /Users/jason/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/Users/jason/package.json'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /Users/jason/.npm/_logs/2024-07-07T09_47_54_261Z-debug-0.log

I tried doing some of the solutions online, but none of them fixed anything (Sorry, this is kinda my first time cloning a repository and doing these stuff, so I apologize if this is a stupid question and there's a stupidly easy solution)

Oh yeah running node index.js gives this error:

jason@Jasons-MacBook ~ % node index.js
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module '/Users/jason/index.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.15.0

Ty if you see this (idk how github works)

Specify which character you would like to redeem on

The config has a message that if you have multiple characters on the same account, eg. different regions. The redemption code will be used but you will not receive any rewards. A simple way around this would be to have an extra option (optional) in the config to specify the uid/region for which character to use the code on.

searchParams: {
t: Date.now(),
lang: "en",
game_biz: "nap_global",
uid: accountData.uid,
region: accountData.region,
cdkey: code
},

"No default or custom configuration found."

Followed all the usual steps after updating to the latest commit and I keep getting this error, even if I were to leave the config on 'default.config.js' it pushes this same error.
image

Getting "/bin/sh: git: not found <WARN:Cron:RealmCurrency> No active accounts to run the cron" while running the Code Redeems

Just trying to use the code redemption for starrail and zzz and getting the following output
Does it mean its working?

2024-07-14 15:55:34 > start
2024-07-14 15:55:34 > node index.js
2024-07-14 15:55:34 
2024-07-14 15:55:35 2024-07-15 06:55:35 <INFO:System> Log level set to info
2024-07-14 15:55:35 2024-07-15 06:55:35 <INFO:Client> Loading configuration data
2024-07-14 15:55:35 2024-07-15 06:55:35 <INFO:Client> Loaded 5 configuration entries
2024-07-14 15:55:35 2024-07-15 06:55:35 <WARN:Client> Skipping discord platform (inactive)
2024-07-14 15:55:35 2024-07-15 06:55:35 <WARN:Client> Skipping telegram platform (inactive)
2024-07-14 15:55:35 2024-07-15 06:55:35 <WARN:Client> Skipping webhook platform (inactive)
2024-07-14 15:55:35 2024-07-15 06:55:35 <INFO:Cron> Initialized 9 cron jobs
2024-07-14 15:55:35 2024-07-15 06:55:35 <WARN:Client> Skipping honkai account (inactive)
2024-07-14 15:55:35 2024-07-15 06:55:35 <WARN:Client> Skipping genshin account (inactive)
2024-07-14 15:55:37 2024-07-15 06:55:37 <INFO:ZenlessZoneZero> Logged into (removed) Phaethon (NA)
2024-07-14 15:55:37 2024-07-15 06:55:37 <INFO:StarRail> Logged into (removed) Trailblazer (NA)
2024-07-14 15:55:37 2024-07-15 06:55:37 <INFO:Client> Initialize completed (2411.33943ms)
2024-07-14 15:56:00 /bin/sh: git: not found
2024-07-14 16:00:00 2024-07-15 07:00:00 <WARN:Cron:RealmCurrency> No active accounts to run the cron

Bunch of "invalid request"

Webhook is still working
image

But I'm getting "invalid request" error codes in the console, recently synched my fork to yours

image

Regarding auto code redeem

I’m not sure if it’s a bug. My config for Genshin-Impact auto code redeem is set to true. Additionally, the control panel shows
2024-08-06 22:49:00 hoyolab-auto | 2024-08-06 22:49:00 INFO:GenshinResolver Found 1 new codes
but my Discord webhook hasn’t received any information about the redemption

[Suggestion] Method of notifying or updating expired cookie

Hoyolab cookies do not last forever, so ideally there should either be a notification that let's the person know if the cookie has expired, or even better, a method to allow the user directly or indirectly update their cookie. Note that for the latter, it may require user interaction due to captcha.

And I am totally not making this suggestion because I got three notifications of code redemption failures caused by not being logged in, even though I had the cookie setup in the config... 👀

Failed to Login

Tried starting, followed the whole install guide to the letter, but this shows up.
Same goes for the other accounts (Star Rail, Zenless)

hoyolab auto check in error

I checked previously resolved issues and found one similar to mine a month ago, and I tested with the other, larger-sized cookie.
Didn't work either.

[Non-Urgent/Support req.] Error: Provided message is not an object

This tool has been working great for me. However, I'm having issues setting up the discord webhook notifier. I've attached my config and the error message below.

Are there any glaring errors in my config?

Note: ... is just redacted parts of the file.

2024-08-04 00:00:01 <INFO:Client> {
  message: 'Unhandled promise rejection',
  args: {
    reason: Error: Provided message is not an object
    - args: {"message":{"type":"string","constructor":"String"}}
        at Webhook.send (/home/.../Documents/GitHub/hoyolab-auto/platforms/webhook.js:16:10)
        at Object.checkIn [as code] (/home/.../Documents/GitHub/hoyolab-auto/crons/check-in/index.js:81:20)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      [cause]: undefined
    }
  }
}
{
    loglevel: 'info',
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
    platforms: [
        {
            id: 1,
            active: true,
            type: 'discord', // This platform is optional, only use this if you have want to access commands via Discord bot
            botId: '12...8', // Your Discord bot ID
            token: 'MT...E',
        },
        {
            id: 2,
            active: true, // Set to true if you want to send notification to Discord webhook
            type: 'webhook',
            url: 'https://discord.com/api/webhooks/12...3/gj...l', // You can follow this guide to create a webhook: https://github.com/torikushiii/hoyolab-auto/blob/main/setup/DISCORD_WEBHOOK.md
        },
    ],
    crons: {
        whitelist: [], // You can whitelist some crons if you only want to run specific crons
        blacklist: [], // You can blacklist some crons if you don't want to run them
        // You can use this site to generate cron expression: https://crontab.guru/
        checkIn: '0 0 0 * * *',
        codeRedeem: '*/15 * * * *',
        dailiesReminder: '0 0 21 * * *',
        howlScratchCard: '0 0 21 * * *',
        expedition: '0 */30 * * * *',
        missedCheckIn: '0 0 23 * * *',
        realmCurrency: '0 */1 * * *',
        shopStatus: '0 */1 * * *',
        stamina: '0 */30 * * * *',
        weekliesReminder: '0 0 21 * * 0',
    },
    accounts: [
        {
            id: 1,
            active: true, // Set to true if you want to enable Genshin Impact
            type: 'genshin',
            data: [
                {
                    cookie: 'mi18nLang=... HYV_LOGIN_PLATFORM_LOAD_TIMEOUT={}; HYV_LOGIN_PLATFORM_TRACKING_MAP={}',
                    // Enable this if you want to automatically redeem codes
                    // Please note that if you have one account with characters in multiple servers
                    // the code will be redeemed but you won't get the reward
                    // so please be careful when enabling this, and only enable it on the account that you want to redeem the code
                    redeemCode: true,
                    dailiesCheck: false, // Enable this if you want to get reminded to do your daily commissions
                    weekliesCheck: false, // Enable this if you want to get reminded to do your weeklies
                    realm: {
                        check: false,
                        persistent: false,
                    },
                    stamina: {
                        check: false, // Enable this if you want to get notified when your stamina is above the threshold
                        threshold: 150, // Your stamina threshold, only fires notification when your stamina is above this value
                        persistent: false, // Set to true if you want to get notified every time your stamina is above the threshold
                    },
                    expedition: {
                        check: false, // Enable this if you want to get notified when your expedition is done
                        persistent: false, // Set to true if you want to get notified every time your expedition is done
                    },
                },
            ],
        },
        {
            id: 2,
            active: true,
            type: 'zenless',
            data: [
                {
                    cookie: 'mi18nLang=... HYV_LOGIN_PLATFORM_LOAD_TIMEOUT={}; HYV_LOGIN_PLATFORM_TRACKING_MAP={}',
                    redeemCode: true,
                    shopStatus: true, // This will check if your shop has finished selling videos
                    dailiesCheck: true,
                    stamina: {
                        check: true,
                        threshold: 200,
                        persistent: false,
                    },
                },
            ],
        },
    ],
}

P.S. It's likely that this is simply user error, but I wasn't able to figure it out myself. Hopefully, this isn't too much of a burden...

Just updated getting error

Just a question, I just updated my files to the latest and since Ive been getting these errors, any explanation? Rather is it anything to be worried about?
NVIDIA_Overlay_EyJ5RjcDXo

Auto Code Redemption

Are there any plans to add an auto code redemption feature? The idea is to fetch and redeem codes automatically. I will potentially look into implementing this myself if I get the time.

[GI] Serenitea Pot - Realm Currency

Could you please add Serenitea Pot Realm Currency to track the current count? I believe I saw it in genshin/api/dailyNote as current_home_coin

Failed to log-in

I updated my fork to the latest and subsequently the new cookie structure and it's throwing these please log-in errors which I'm confused about. am I supposed to log into the game?

image

Command Execution Failed (Discord slash commands)

I'm getting command execution failed when I'm trying to execute /note command in Discord; however, the script keeps running, and I have the same error on the bot reply as well

image

Logs:

  message: 'Command execution failed',
  data: {
    command: 'notes',
    invocation: 'notes',
    platform: 1,
    args: [ 'starrail' ],
    error: Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
        at ChatInputCommandInteraction.reply (/root/hoyolab-auto/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:104:46)
        at Command.notes [as code] (/root/hoyolab-auto/commands/notes/index.js:188:23)
        at async Command.checkAndRun (/root/hoyolab-auto/classes/command.js:202:16)
        at async DiscordController.handleCommand (/root/hoyolab-auto/platforms/discord.js:182:21)
        at async Client.<anonymous> (/root/hoyolab-auto/platforms/discord.js:109:4) {
      code: 'InteractionAlreadyReplied'
    }
  }
}

Several invalid attempted code redemptions

Checked my check-in channel to find that it had attempted to redeem these for Star Rail.

2024-08-08 09:45:09 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Go' } }
2024-08-08 09:45:17 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Log' } }
2024-08-08 09:45:25 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Select' } }
2024-08-08 09:45:32 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Input' } }
2024-08-08 09:45:40 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Claim' } }
2024-08-08 09:45:47 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Open' } }
2024-08-08 09:45:55 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Click' } }
2024-08-08 09:46:03 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Return' } }
2024-08-08 09:46:10 <INFO:CodeRedeem:StarRail> { message: 'Expired or invalid code', args: { code: 'Tap' } }

[Bug] Redemption code websites responses

Errors related to inaccessible webpage with redemption codes should be displayed as 1 line:
2024-07-08 14:18:00 <INFO:ReadWrite> Failed to fetch data from ReadWrite.
instead of printing the whole website to terminal.

2024-07-08 12:43:58 <INFO:Client> Initialize completed (3734.898701ms)
2024-07-08 14:18:00 <INFO:ReadWrite> {
  message: 'Failed to fetch data from ReadWrite.',
  statusCode: 500,
  response: '<!DOCTYPE html>\n' +
    "<html dir='ltr'>\n" +
    '<head>\n' +
    '\t<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n' +
    '\t<meta name="viewport" content="width=device-width">\n' +
    '\t\t\t<title>Database Error</title>\n' +
    '\t<style type="text/css">\n' +
    '\t\thtml {\n' +
    '\t\t\tbackground: #f1f1f1;\n' +
    '\t\t}\n' +
    '\t\tbody {\n' +
    '\t\t\tbackground: #fff;\n' +
    '\t\t\tborder: 1px solid #ccd0d4;\n' +
    '\t\t\tcolor: #444;\n' +
    '\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n' +
    '\t\t\tmargin: 2em auto;\n' +
    '\t\t\tpadding: 1em 2em;\n' +
    '\t\t\tmax-width: 700px;\n' +
    '\t\t\t-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);\n' +
    '\t\t\tbox-shadow: 0 1px 1px rgba(0, 0, 0, .04);\n' +
    '\t\t}\n' +
    '\t\th1 {\n' +
    '\t\t\tborder-bottom: 1px solid #dadada;\n' +
    '\t\t\tclear: both;\n' +
    '\t\t\tcolor: #666;\n' +
    '\t\t\tfont-size: 24px;\n' +
    '\t\t\tmargin: 30px 0 0 0;\n' +
    '\t\t\tpadding: 0;\n' +
    '\t\t\tpadding-bottom: 7px;\n' +
    '\t\t}\n' +
    '\t\t#error-page {\n' +
    '\t\t\tmargin-top: 50px;\n' +
    '\t\t}\n' +
    '\t\t#error-page p,\n' +
    '\t\t#error-page .wp-die-message {\n' +
    '\t\t\tfont-size: 14px;\n' +
    '\t\t\tline-height: 1.5;\n' +
    '\t\t\tmargin: 25px 0 20px;\n' +
    '\t\t}\n' +
    '\t\t#error-page code {\n' +
    '\t\t\tfont-family: Consolas, Monaco, monospace;\n' +
    '\t\t}\n' +
    '\t\tul li {\n' +
    '\t\t\tmargin-bottom: 10px;\n' +
    '\t\t\tfont-size: 14px ;\n' +
    '\t\t}\n' +
    '\t\ta {\n' +
    '\t\t\tcolor: #2271b1;\n' +
    '\t\t}\n' +
    '\t\ta:hover,\n' +
    '\t\ta:active {\n' +
    '\t\t\tcolor: #135e96;\n' +
    '\t\t}\n' +
    '\t\ta:focus {\n' +
    '\t\t\tcolor: #043959;\n' +
    '\t\t\tbox-shadow: 0 0 0 2px #2271b1;\n' +
    '\t\t\toutline: 2px solid transparent;\n' +
    '\t\t}\n' +
    '\t\t.button {\n' +

   ...

Running on a Raspberry Pi

I'm trying this out on a raspberry pi and I think it's working.
Untitled
Will this continue to run when I exit SSH to my Pi?

About the Docker auto redeem code

Today there is a new redeem code for Star Rail, but it cannot be redeemed correctly

I am very sure that the account has not redeemed this code before
螢幕擷取1

and I have re-cloned the git repository and re-composed

edit :
I tried running it locally, but the same issue still occurs

Discord bot is offline

When I try to set the discord platform to "true" my discord bot is still offline after running the script, but the rest is fine

image

Regarding the Docker section of the README

If you only install Docker without installing Make, you will not be able to use the method described in the README to start the Docker container. You might still need to use the previous method to start it

or install make

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.