spdermn02 / TouchPortal_Discord_Plugin

Touch Portal Plugin to Interact with Discord
GNU General Public License v3.0
60 stars 24 forks source link

How to reset a button after reading a DM? #91

Closed ApophysX closed 2 weeks ago

ApophysX commented 2 weeks ago

No issue, just a question. I created a button in Touch Portal (${value:discord_DM_user}) when I get a DM the user is displayed, when I have read the message and there are no more new messages, the button should display something else. How do you do that?

spdermn02 commented 2 weeks ago

Can you share a snapshot of your button? That way we see how you have it setup.

ApophysX commented 2 weeks ago

i Can :) Bild_2024-09-12_195050323

that's not how it works Bild_2024-09-12_195558011

spdermn02 commented 2 weeks ago

Is that bottom one working? That would be the way to indicate the change happened

gitagogaming commented 2 weeks ago

No issue, just a question. I created a button in Touch Portal (${value:discord_DM_user}) when I get a DM the user is displayed, when I have read the message and there are no more new messages, the button should display something else. How do you do that?

The event we get from discord only lets us know that one came in, it also will not trigger if that DM is actively open (just like a normal DM sound on discord)

So because we only know when we get a DM, we cant trigger a plugin side event that knows when a DM has been viewed or the notification is gone.

So to 'work around' this we would have to create a custom value and use it to reset the text on the button when we need it to.
Here is an example

image

I've also attached the button example, you wil have to rename it to a tpb file name as I had to change it to upload here directly. Discord-DM-Event-Example.zip

ApophysX commented 2 weeks ago

No issue, just a question. I created a button in Touch Portal (${value:discord_DM_user}) when I get a DM the user is displayed, when I have read the message and there are no more new messages, the button should display something else. How do you do that?

The event we get from discord only lets us know that one came in, it also will not trigger if that DM is actively open (just like a normal DM sound on discord)

So because we only know when we get a DM, we cant trigger a plugin side event that knows when a DM has been viewed or the notification is gone.

So to 'work around' this we would have to create a custom value and use it to reset the text on the button when we need it to. Here is an example

image

I've also attached the button example, you wil have to rename it to a tpb file name as I had to change it to upload here directly. Discord-DM-Event-Example.zip

Okay and thank you very much, it works.