⚡ A person who is passionate about technologies, open-source, reverse engineering, convenience, etc.
- en-US / jp-JP
- Programmer / Developer
- Likes to collect stuff
✨ If you like my projects, you can buy me a coffee at:
Auto check-in and others for any Hoyoverse games
Home Page: https://ko-fi.com/torikushiii
License: GNU Affero General Public License v3.0
In issue #16 you have mentioned "commands".
I believe we have 4 of them:
How to use them?
Can you make a video quick start on docker usage? I'm stuck on using the make file
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?
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).
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. 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
},
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?
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)
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.
hoyolab-auto/hoyolab-modules/zenless.js
Lines 368 to 375 in 35f851d
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
Does the google script auto-redeem codes as well?
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
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... 👀
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...
When I enter /redeem game Zenless Zone Zero code [anything]
, it always returns Please specify a code.
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.
volumes:
- ./config.json:/app/config.json:ro
- ./data:/app/data
config.json
will not load by the app, should be config.js
.
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
There's a typo in the Discord webhook embed where it says "Dalies Reminder" instead of "Dailies Reminder".
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
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'
}
}
}
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' } }
Is it possible to move all cron "time configuration" to config.js file?
To have something like:
realm-currency_expression: "0 0 * * * *"
stamina_expression: "0 */30 * * * *"
expedition_expression: "0 */30 * * * *"
etc...
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' +
...
Are you planning to implement slash command for the Discord bot? It's much easier to see the commands and their respective arguments.
Would it be possible to add a stamina check to Honkai Impact?
Hello just figured Id ask is there anything we can adjust in the files to adjust for the new maximum resin in Genshin?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.