christopher-roelofs / GameEventHub

Game based event integrations for multiple systems
MIT License
5 stars 1 forks source link

Activity is not getting updated on either of my Discord clients #1

Closed Drakonas closed 2 years ago

Drakonas commented 2 years ago

GameEventHub_2022-06-16_19-06-02 Perhaps I'm misunderstanding how this application works, but I have the Discord subscriber enabled, and I have the MiSTer publisher enabled.

The app detects game changes. Both my Discord clients have Game Activity enabled, but detect no games running at all. The Rich Presence activities don't seem to reach either of them. I run Discord and DiscordPTB for two separate accounts.

The documentation here states you should be sequentially pinging the entire range of 10 RPC ports to be sure it reaches known clients:

https://discord.com/developers/docs/topics/rpc#rpc-server-ports

Is this occurring? I'm trying to figure out if I did something wrong, or this is something wrong with the program.

I'm just trying to brainstorm. I'm out of ideas.

christopher-roelofs commented 2 years ago

Take a look at the readme for discord subscriber. This uses the rpc protocol used by the desktop app that needs to be running on the same machine as the script. This has only been tested on the official discord desktop app.

For the Discord subcriber to work, you need to have the discord application install on the same machine the script is running on. This uses the RPC protocol.

Setup an appication in Discord that will be used for this integration

Discord Config

Config | Example | Details -- | -- | -- application_id | 1234567890 | Discord application id reconnect | true/false | reconnect to discord if failed to connect after initail retries
  "discord": {
        "application_id":"",
        "reconnect":true
    }

In the pubsub.json file this requires an extra field for type because the library being use is async.

"Discord":{
   "status":"enabled",
   "type":"async",
   "subscribed_events":[]
}

Discord subscriber only has one action so it does not need to be defined. State and details are require, the rest can be left as "" if not wanted. The images are the names of the images uploaded in the developer portal. {tokens} can be used as the values to set them dynamically based on the event. The names will be set to lowercase automatically because discord makes the image names lowercase when uploading. Values for button links can't use {tokens} because discord does not seem to actually apply the change. It is best to use these for links that will not change like a twitch or youtube channel. You can max a max of 2 buttons and if no buttons are wanted remove the buttons field from the json object.

{
   "description":"Set the Discord status for the current game",
   "status":"enabled",
   "state_text":"{release_name}",
   "details_text":"{system}",
   "small_text":"",
   "small_image":"misterkun",
   "large_text":"",
   "large_image":"{core}",
   "buttons":[
      {
         "label":"Button 1",
         "url":"https://www.google.com"
      },
      {
         "label":"Button 2",
         "url":"https://www.google.com"
      }
   ]
}
Drakonas commented 2 years ago

So I had read all of that, and the part I was missing was that I had to actually configure the JSON with events and actions myself for it to do anything. I misunderstood this. The section for how to do it was far above the Discord and MiSTer sections, so I didn't think it was related to my interests.

Apologies. Maybe mentioning these steps in the setup section (after the developer portal stuff) would be a good idea?

  1. Enable at least one subscriber and one publisher in pubsub.json.
  2. Add events in the pubsub.json for the subscriber(s), and any number of actions you wish to have trigger when the event fires. See the "Publisher/Subscriber Model" section for details, referring to the events in each publisher section and actions listed in each subscriber section for how to configure. You can have one action per event, but list the same event multiple times.
  3. If using the Discord subscriber, make sure to upload any wanted images to the Developer portal under the "Rich Presence" assets section, and name them to match what is in your actions. If it is a dynamic item, like {core} for example, keep in mind the image names cannot have spaces. The {core} names from the MiSTer should not have spaces, so this works for them. (naming the images atarilynx or gba2p, for example) Letter case does not matter.
  4. Run the application while Discord is running on the same machine. DiscordPTB and Nightly are not supported. It should automatically connect to Discord, and start listening for the enabled publisher(s).
christopher-roelofs commented 2 years ago

Thanks for the feedback. I've added your steps to the readme.