torikushiii / hoyolab-auto

Auto check-in and others for any Hoyoverse games
https://ko-fi.com/torikushiii
GNU Affero General Public License v3.0
110 stars 24 forks source link

Add user ping for discord webhook alerts #53

Closed Lynaia closed 3 months ago

Lynaia commented 3 months ago

It would be really useful for the stamina, daily, weekly, and expedition to ping the respective account owner. Having individuals to turn on all notifications for a single channel when it is getting spammed with info for several users isn't ideal.

My understanding is user ping don't work with embedded messages, but maybe send a normal message with @ along with the associated embedded?

Should also have a setting for the ping to be on/off, similar to the persistent for stamina/expeditions.

YozenPL commented 3 months ago

Well, you can create new text channel and make it private. Only you will see it and you will be "the only person who is receiving those notifications".

Lynaia commented 3 months ago

I don't really understand how that solves my issue?

If I have 10 different accounts belonging to 10 different people, how do I notify the respective person (and only that person) each time a notification comes up for someone to do their dailies/dump stamina, etc when it can be any of those 10 people?

YozenPL commented 3 months ago

My bad. I read it as 10 individual accounts no 10 individual owners :D

torikushiii commented 3 months ago

Hello, thank you for your suggestion,

Is this how you'd want it to be?

image

Lynaia commented 3 months ago

Yes, that is perfect unless there is a better solution that I am not aware of! Just anything that can ping/notify a specific account owner is what I am looking for.

torikushiii commented 3 months ago

Hi, I've implemented this feature at the latest commit and it will look like this

image

for configuration you'll need to add user discord id under the config file that will look like this

{
    id: 3,
    active: true, // Set to true if you want to enable Genshin Impact
    type: 'genshin',
    data: [
        {
            cookie: '',
            // Enable this if you want to automatically redeem codes
            // Please note that if you have one account with characters in multiple servers
            // the code will be redeemed but you won't get the reward
            // so please be careful when enabling this, and only enable it on the account that you want to redeem the code
            redeemCode: false,
            dailiesCheck: true, // Enable this if you want to get reminded to do your daily commissions
            weekliesCheck: true, // Enable this if you want to get reminded to do your weeklies
            realm: {
                check: false,
                persistent: false,
            },
            stamina: {
                check: false, // Enable this if you want to get notified when your stamina is above the threshold
                threshold: 150, // Your stamina threshold, only fires notification when your stamina is above this value
                persistent: false, // Set to true if you want to get notified every time your stamina is above the threshold
            },
            expedition: {
                check: false, // Enable this if you want to get notified when your expedition is done
                persistent: false, // Set to true if you want to get notified every time your expedition is done
            },
            discord: {
                // Your Discord user ID to ping you when to do your dailies/weeklies
                // or when your stamina is above the threshold and your expedition is done
                // this is optional, you can leave it as null if you don't want to get pinged
                userId: null,
            }
        },
    ],
},

where you'll need to define the user id here

discord: {
    // Your Discord user ID to ping you when to do your dailies/weeklies
    // or when your stamina is above the threshold and your expedition is done
    // this is optional, you can leave it as null if you don't want to get pinged
    userId: null,
}

this field is not required by default, so you can either leave it null or never define it at all

Lynaia commented 3 months ago

Is this the proper way to add the userId? image

It is showing up as unknown user image

torikushiii commented 3 months ago

that should be correct, but can you try adding quotation marks so it'll be like this "114685558084599808"

Lynaia commented 3 months ago

adding single quotes worked, '0123456789'

torikushiii commented 3 months ago

👍 I assume everything works fine and as intended?

Lynaia commented 3 months ago

Yes! Everything looks great!