Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple hoyolab accounts + a more readable discord/telegram output message #4

Merged
merged 8 commits into from
May 12, 2023

Conversation

cd36th
Copy link
Contributor

@cd36th cd36th commented May 12, 2023

Created a profiles array containing the token, game booleans and accountName (previously myDiscordName). This allows for multiple hoyolab accounts to be included in the one code, that don't all have to play the same games for the check-ins to work.
The main() function loops through the profiles listed.

I have also created urlDict to contain the sign-in URLs. This makes it easier to replace the links if they ever change for whatever reason. I have also used this in autoSignFunction() to create a dynamic array of URLs for the games that should be checked-in for each profile so that the "if (game == true)" statements don't need to be repeated.

Then I created a more structured output message, creating sentences based around accountName, and the check in message for each game being formatted by "gameName: hoyolabResponse" so that the end user can see exactly what happened in the check-in.

Note that as I don't speak Chinese, I wasn't able to translate Check-in completed for ${accountName}, and just left it as ${accountName} in the Chinese versions.
Also note that as I don't use Telegram I was unable to test the changes myself, however as I didn't change anything with postWebhook() it should work the same as Discord, which I was able to test both languages for successfully.

@cd36th cd36th closed this May 12, 2023
…eviously but is required for the multiple profile functionality
@cd36th cd36th reopened this May 12, 2023
Copy link
Owner

@canaria3406 canaria3406 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your pull request. This really helps!

@canaria3406 canaria3406 merged commit 7b98443 into canaria3406:main May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants