Skip to content

Sergiy3013/genshin_card

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Genshin Card

This tool generates images with your statistics.

Example 1 Example 2 Example 3 Default
Params CARD_AVATAR=Ganyu
CARD_BG=bg_3
CARD_LANG=lang_UA
CARD_HIDE_ID=All
CARD_AVATAR=Diluc
CARD_BG=bg_9
CARD_LANG=lang_ENG
CARD_AVATAR=Shenhe
CARD_BG=bg_10
CARD_LANG=lang_RU
CARD_AVATAR=Default
CARD_BG=Default
CARD_LANG=Default
Immage Ganyu UA Card Diluc ENG Card Shenhe RU Card Default Card

How to use this tool?

Fork this repository and you can move on to the next step.

How to configure the app:

  • You provide the app with some settings of your HoYoLab website cookies.
  • You provide the app with your Telegram bot token
  • You launch the app and send a message to the bot, and you'll receive your chat ID in response
  • You provide the program with your chat id
  • If you have configured the card parameters, they will be applied during generation, if not, then the default parameters will be used during generation
  • The bot will send you your stats card

1) Receiving Your Account Cookies

Instruction
  1. I'm using Chrome browser, if you're using a different browser, some names may vary.
  2. Open the get cookies skript file and copy its contents.
    var cookie=start();
    var ask=confirm('Cookie: '+cookie+'\n\nClick confirm to copy Cookie.');if(ask==true){copy(cookie);msg=cookie}else{msg='Cancel'}
    function start() {
        return "ltoken=" + getCookie("ltoken") + ";ltuid=" + getCookie("ltuid") + ";";
        function getCookie(name) {
            const value = ";" + document.cookie;
            const parts = value.split("; " + name + "=");
            if (parts.length === 2) return parts.pop().split(';').shift();
        }
    }
    
  3. Go to https://www.hoyolab.com/genshin/ then login.
  4. Right-click on the page and click on View Code, then click on the Console tab.
  5. Paste the code you copied in the second paragraph and press Enter.
  6. In the window that appears, click Ok and the necessary Cookies will be automatically copied to your clipboard. Cookie copy window

2) Create your own Telegram bot

Instruction
  1. Open a chat with an official Telegram bot (@botfather) to create your own bot.
  2. Send the bot the command "/newbot" to initiate the process of creating a new bot
  3. Come up with a name for your bot, in my case it will be "GenshinCard"
  4. Now we need to come up with a nickname for the bot, I chose "GenshinCardExampleBot"
  5. In response, we will receive a message containing a link to your bot and an API token

3) Set up variables in GitHub

Instruction

Adding cookies

  1. Let's add Cookies to the variable, for this go to the following path in the cloned repository Settings -> Secrets -> Actions -> New repository secret Path to add Cookies to repository variable
  2. Enter a variable name and Cookies depending on what you want to set up your repository for. Page for adding variables In the first field you need to specify the name of the variable, in the second field Cookies. See examples below.
  3. Variable name: HOYOLAB_COOKIES, Cookies example: ["ltoken=a**************************************B;ltuid=1******2;","ltoken=c**************************************D;ltuid=3******4;","ltoken=e**************************************F;ltuid=5******6;"] In this case, you need to open square brackets [ list received in the section Getting your account's Cookies, Cookies must be in double quotes ", separated by commas and then close square brackets ].
  4. Click the Add secret button to add a variable. Adding Cookies for Multiple Accounts

Adding API keys of Telegram bot

The first two steps are similar, so let's move on to the third 3. Variable name: TG_API, Secret: 5656875323:AAG9KsVrNg02cvBgIbpUOs18htgaPKQehGw(the API key of your bot) Adding Cookies

4) Run the app to get your bot chat ID

Instruction
  1. Open "Actions" in a new tab because we will still need the current one.
  2. Create an action that will be executed daily at 06:00 (UTC+8) Actions -> Card generate -> Run workflow -> Run workflow Adding Actions
  3. Now go to your telegram bot and run it, if everything is done correctly you will get a message with your ID. Take your time, the bot needs time to install all modules and start. (You can send him any messages to make sure you don't miss a moment when he will be working) Get UID

5) Add a UID variable so the bot knows who to send cards to

Instruction
  1. We return to the first tab (do not close the second one, you will also need it a little later)
  2. Add another secret, name: TG_UID, Secret: 1008299086 (Your UID) Adding TG_UID

6) Card settings (optional)

Instruction

Avatar settings

  1. Choose an avatar

    Show available avatars (60)
    Immage Params Immage Params
    Albedo Albedo Aloy Aloy
    Amber Amber Arataki_Itto Arataki_Itto
    Barbara Barbara Beidou Beidou
    Bennett Bennett Candace Candace
    Chongyun Chongyun Cyno Cyno
    Diluc Diluc Diona Diona
    Dori Dori Eula Eula
    Faruzan Faruzan Fischl Fischl
    Ganyu Ganyu Gorou Gorou
    Hu_Tao Hu_Tao Jean Jean
    Kaedehara_Kazuha Kaedehara_Kazuha Kaeya Kaeya
    Kamisato_Ayaka Kamisato_Ayaka Kamisato_Ayato Kamisato_Ayato
    Keqing Keqing Klee Klee
    Kujou_Sara Kujou_Sara Kuki_Shinobu Kuki_Shinobu
    Layla Layla Lisa Lisa
    Mona Mona Ningguang Ningguang
    Noelle Noelle Paimon Paimon
    Qiqi Qiqi Raiden_Shogun Raiden_Shogun
    Razor Razor Rosaria Rosaria
    Sangonomiya_Kokomi Sangonomiya_Kokomi Sayu Sayu
    Shenhe Shenhe Shikanoin_Heizou Shikanoin_Heizou
    Sucrose Sucrose Tartaglia Tartaglia
    Thoma Thoma Tighnari Tighnari
    Traveler_Eather Traveler_Eather Traveler_Lumine Traveler_Lumine
    Venti Venti Wanderer Wanderer
    Xiangling Xiangling Xiao Xiao
    Xingqiu Xingqiu Xinyan Xinyan
    Yae_Miko Yae_Miko Yanfei Yanfei
    Yelan Yelan Yoimiya Yoimiya
    Yun_Jin Yun_Jin Zhongli Zhongli
  2. Add a secret with the name CARD_AVATAR and the avatar parameter of your choice. For example, I chose Chongyun Adding CARD_AVATAR

Background settings

  1. Choose an background

    Show available backgrouns (32)
    Immage Params Immage Params
    bg_1 bg_1 bg_2 bg_2
    bg_3 bg_3 bg_4 bg_4
    bg_5 bg_5 bg_6 bg_1
    bg_7 bg_7 bg_8 bg_8
    bg_9 bg_9 bg_10 bg_10
    bg_11 bg_11 bg_12 bg_12
    bg_13 bg_13 bg_14 bg_14
    bg_15 bg_15 bg_16 bg_16
    bg_17 bg_17 bg_18 bg_18
    bg_19 bg_19 bg_20 bg_20
    bg_21 bg_21 bg_22 bg_22
    bg_23 bg_23 bg_24 bg_24
    bg_25 bg_25 bg_26 bg_26
    bg_27 bg_27 bg_28 bg_28
    bg_29 bg_29 bg_30 bg_30
    bg_31 bg_31 bg_32 bg_32
  2. Add a secret with the name CARD_BG and the avatar parameter of your choice. For example, I chose bg_4 Adding CARD_BG

Language settings

  1. Choose an language

    Show available languages (3)
    Immage Params Immage Params
    lang_UA lang_UA lang_ENG lang_ENG
    lang_RU lang_RU
  2. Add a secret with the name CARD_LANG and the avatar parameter of your choice. For example, I chose lang_UA Adding CARD_LANG

Display user id settings

Add a secret with the name CARD_HIDE_ID and the avatar parameter of your choice. For example, I chose lang_UA

Show parameters | Parameter | What is he doing | | --------- | ------------------------------------------------------------------------------------------------------ | | `All` | Your name ID will not appear on the card and the bot will send your card without the ID in the message | | `Card` | Your name ID will not appear on the card | | `Message` | The bot will send your card without the ID in the message |

7) Let's go to start the action and get our card

Instruction
  1. Follow the same steps as in section 4. I've made very detailed comments, so you'll always know what the app is doing right now. App execution
  2. If you did everything correctly, the bot will send you a card to each specified account Cards in chat
  3. Result (Because telegram compresses the image before sending and changes the format to jpg, the background appears in the card. If you send cards without compression, the format will not change) Result

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published