Support for multiple hoyolab accounts + a more readable discord/telegram output message #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.