Coder Social home page Coder Social logo

hoyolab-daily-bot's Introduction

Genshin Hoyolab Daily Check-in Bot πŸ“œπŸ–‹

Genshin Impact's Hoyolab Daily Check-in Bot is here! The concept is simple, run once, run forever. You only need to run it once, then it will continue to run forever (except if you uninstall it ofc tehe)

Demo Gif

Disclaimer: Only works on Windows (Linux & Mac version coming soon!)

Features πŸƒ

  • Run once, run forever✨ The program will configure itself to run daily according to your localtime's reward claiming time. It will also autorun if your laptop/computer is in sleep mode, and will still run the next time your computer is on if you skipped the server refresh time.
  • If there's no connection, it will wait for a minute. No maximum retry.

Prerequisites 🎯

  • Windows OS
  • Have login to mihoyo's website at any browser (A login for a year is enough)

How to use ✨

  1. Download the newest release (.zip) and extract
  2. Run program and click Yes when prompted. The program needs to be run as administrator to enable scheduling
  3. You can see what's the bot doing from botlog.txt.

Configuration File (v1.1.5+)

  • BROWSER: You can target specific browser to be used for login. Please beware that this program doesn't support account chooser yet, so if you have multiple account you may use a browser you rarely use that only contains 1 account information.
    Currently supported browsers are: firefox, chrome, chromium, opera, and edge. The default is all.
  • SERVER_UTC: Server UTC in each server is different. You can check your UTC in Your Hoyolab Daily Check-in page. The default for Asia server is +8 UTC.
  • DELAY_MINUTE: Sometimes, your PC is some minutes earlier than the server time. If you're experiencing reward already claimed whenever the bot started, please add some delay.
  • RANDOMIZER: Turn on (true) or off (false) for randomizing bot scheduler. Default is false
  • RANDOM_RANGE: Range in seconds for randomizing bot scheduler. Default is 3600 (means the bot will starts delayed randomly within 1 hour after daily reset).
  • SCHEDULER_NAME: The name of the bot scheduler. With this, you can have multiple bot scheduled with different configurations. For example, in one folder the bot is configured to login from chrome, while the other one is configured to login from firefox. The default is "HoyolabCheckInBot".
  • ACT_ID and DOMAIN_NAME doesn't need changing. It's only there for futureproof reasons.

How to update πŸ“ˆ

Just overwrite the executable file haha

Development Setup

  1. Setup virtualenv
    pip install virtualenv
    python -m venv venv
    venv\Scripts\activate
    
  2. Install dependencies
    pip install -r requirements.txt
    
  3. Run python main_windows.py or run.bat as administrator if you want to run the scheduling, or if not use python main_windows.py -R or run.bat -R.
  4. Use Pyinstaller to compile into binary.

Feel free to open up issues for feature request, bugs, etc. or contribute.

hoyolab-daily-bot's People

Contributors

darkgrimoire 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  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  avatar  avatar  avatar  avatar  avatar

hoyolab-daily-bot's Issues

Adding a randomized delay

Could we possibly specify a randomized delay in the configuration file? I feel like it’s too consistent at the same time

Failed To Find Login Info

I was using Firefox from the start and it just suddenly stopped working. I tried uninstalling and reinstalling and double checking I'm logged in everywhere (Firefox and Edge)... Fiddled with the config file... nothing. No changes are making any difference. :/

whitespace inside url

hey im currently rewriting your script in nodejs (for private usage only) ...
is the whitespace inside the url below intentional?

'Referer': f'https://webstatic-sea.mihoyo.com/ys/event/signin- sea/index.html?act_id={config["ACT_ID"]}&lang=en-us',

thanks for the help
undeaD_D

ps: keep up the good work

Error popup in Windows: Failed to execute script main_windows

Version 1.15 here, no problems (except with expired cookies, easily fixed), until today. I have not installed anything new in weeks.

Getting this error popup today and in the log file, no success/fail message is recorded after the line reporting that execution has started.

image

I've tried it several times and it's consistently failing.

Platform is Windows 10 Pro, version 22H2, OS build 19045.2251.

Python version: Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37)

Linux support

Seems like the only thing holding the script to run on linux is the scheduler.

I propose these changes to add linux compatibility:

  • detect if os is linux
  • if true then either run it periodically with cron or add an entry to current user's crontab

I heard that python-crontab works on windows too, but i'm not sure.
But idk if this is necessary, since on linux i can just edit my crontab to run your script everyday with the "-R" argument.

Bug: Windows task scheduler The parameter is incorrect while executing ...

I'm not too familiar with Windows Task Scheduler, but this issue seemed to go away when I separated 'python' from 'exec_path' and specified python as the executable and 'exec_path' as the argument. The task seems to be running fine now.

Last run status would state: The parameter is incorrect while executing ...

2021-08-08 20_39_32-

Need to log in to hoyolab even though its already logged in

The bot doesnt detect the chrome version as i already have it logged in and when the bot runs it tells me that the cookie is not found and please log into hoyolab.
but i have already re logged in and clear the cookie and tried again and no avail.

Bot not finding login credentials in Chrome and new version of Firefox

This had been working flawlessly for about a week. After it did the check-in yesterday successfully, I noticed a new version of Firefox was available, so I updated (version 106.0). Today I noticed the the bot failed and reported:

Login information not found! Please login first to hoyolab once in Chrome/Firefox/Opera/Edge/Chromium before using the bot.
LOGIN ERROR: cookies not found

I checked Firefox and it was already authenticated for Hoyolab as usual, no problems. So I uninstalled the bot and tried to reinstall it. Now it won't even install as a task, giving the same error as above. In the meantime, Firefox released an incremental update, 106.0.1, but it still doesn't work. I tried logging into Chrome (version 106.0.5249.119) instead, and verified that it is logged in, but got the same result with the bot reporting the same error and doesn't install as a task.

The bot configuration file is what it shipped with except that DELAY_MINUTE has been set to 2.

I have verified that Firefox has Hoyolab cookies set by dumping them out (actual cookie values removed):

.www.hoyolab.com TRUE / FALSE 253402257600 G_ENABLED_IDPS
.hoyolab.com TRUE / FALSE 1697826658 mi18nLang
.hoyolab.com TRUE / FALSE 1697826658 DEVICEFP_SEED_ID
.hoyolab.com TRUE / FALSE 1697826658 DEVICEFP_SEED_TIME
.hoyolab.com TRUE / FALSE 1697826659 DEVICEFP
.hoyolab.com TRUE / FALSE 1697826660 _MHYUUID
.hoyolab.com TRUE / TRUE 1697826661 ltoken
.hoyolab.com TRUE / TRUE 1697826661 ltuid

I redownloaded version 1.15 and tried overwriting the existing files to see if it would make any difference, and sadly it did not.

Error install requirement pyinstaller==4.2

#6704

The problem is caused by the latest setuptools in combination with sdist containing both pyinstaller.py script and PyInstaller package (which end up shadowing each other on case-insensitive OSes, i.e., Windows in macOS). In current versions of pyinstaller, the fix was to remove the script as it is not used anyway (there are auto-generated entry-point scripts) - take a look at pyinstaller/pyinstaller#6701.

We generally don't support old PyInstaller versions, so if you want to continue using 4.0~4.3, you'll need to backport the fix yourself. (EDIT: or pin setuptools to an earlier version).

I try remove pyinstaller and pyinstaller-hooks-contrib from requirement, and the error is gone and the requirement succesfully installed

Python = 3.10
windows 11

Update uninstaller

I asked chatgpt to improve the uninstaller by checking the config file, if it fails to delete it, the code will ask for the name to be entered manually. Small improvement hopefully it helps someone

`
@echo off

:: Use PowerShell to read the SCHEDULER_NAME from config.json
for /f %%i in ('powershell -command "(Get-Content -Raw -Path .\config.json | ConvertFrom-Json).SCHEDULER_NAME"') do set "task_name=%%i"

:: Prompt for task_name if not found in config.json
if "%task_name%" == "" (
set /p task_name="Enter SCHEDULER_NAME: "
)

:: Delete the scheduled task
schtasks /Delete /F /TN "%task_name%"

:: Check the exit code of schtasks
if %errorlevel% neq 0 (
echo Failed to delete task %task_name%. Please enter the correct task name:
set /p task_name="Enter task name: "
schtasks /Delete /F /TN "%task_name%"
if %errorlevel% neq 0 (
echo Failed to delete task %task_name%. Exiting.
) else (
echo Task %task_name% deleted successfully.
)
) else (
echo Task %task_name% deleted successfully.
)

pause
`

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.