canaria3406 / hoyolab-auto-sign

A lightweight, secure, and free script that automatically collect Hoyolab daily check in rewards. Supports Genshin Impact, Honkai Impact 3rd, and Honkai: Star Rail.
MIT License
406 stars 49 forks source link

Shorten checkInResult for english language #10

Closed Nixeld closed 1 year ago

Nixeld commented 1 year ago

Discord webhooks have a 2000 character limit. If the 2000 character limit is exceeded, the webhook will fail to post.

This change shortens the checkInResult by only taking the first sentence.

Before this change, my webhook content is over 2000 characters as I am checking in on 7 different accounts. Only making this change for english as the chinese did not have as many characters.

canaria3406 commented 1 year ago

Is there any example? It seams like there's no . in the webhook content, so .match(/^[^.]+\.?/)?.[0] might not work?

圖片

Nixeld commented 1 year ago

image Here is an example of signing into 5 accounts. There are alot of unnecessary text for accounts which have not have an account on a particular game. If I do anymore accounts than that, I will not receive anything from the webhook due to the 2000 character limit.

canaria3406 commented 1 year ago

This is NOT an unnecessary text . It means that your account data is not present in the Hoyolab database, which indicates that the account has not engaged in that particular game. Instead of hiding this message, you should set the parameters in the configuration file to false.

As your example, it shoud be like:

const profiles = [
  { token: "ltoken=gBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCY; ltuid=26XXXXX20;", 
    genshin: true, 
    honkai_star_rail: true, 
    honkai_3: true, 
    accountName: "account A" },
  { token: "ltoken=gBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCY; ltuid=26XXXXX21;", 
    genshin: true, 
    honkai_star_rail: false, 
    honkai_3: false, 
    accountName: "account B" },
  { token: "ltoken=gBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCY; ltuid=26XXXXX22;", 
    genshin: true, 
    honkai_star_rail: true, 
    honkai_3: false, 
    accountName: "account C" },
  { token: "ltoken=gBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCY; ltuid=26XXXXX23;", 
    genshin: true, 
    honkai_star_rail: false, 
    honkai_3: false, 
    accountName: "account D" },
  { token: "ltoken=gBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCY; ltuid=26XXXXX24;", 
    genshin: true, 
    honkai_star_rail: true, 
    honkai_3: false, 
    accountName: "account E" }
];