Discord-History-Tracker
Discord-History-Tracker copied to clipboard
Save button data?
I can't seem to find the data for Discord buttons anywhere in the DB. Am I missing something?
Example:
If they're embeds, their definition should be saved. If not, then DHT doesn't save them, and probably never will. Discord has so many features now that I don't have the time or will to figure out how everything works, faithfully replicate it, and fix it every time they change something.
I'd like to pick this up (but no promises). Where is the tracking script for the app stored?
It's in app/Resources/Tracker
. The app
folder has a minify.py
Python script, make sure to run it anytime you change the scripts, otherwise the app won't see the changes. If you use Rider, there is a run configuration for the Python script:
Keep in mind that depending on how complicated it ends up being, I probably won't accept a PR because I don't want to maintain another complicated part of DHT that might get broken anytime Discord updates.
By analysing the network traffic, I found that it's in the "Components" JSON key!!
Now I just need to figure out how DHT's code works. I doubt that the button JSON will change but if it does, it'll probably be a simple fix.
Do I just have to add id: msg.components,
to this or is there more?
https://github.com/chylex/Discord-History-Tracker/blob/master/app/Resources/Tracker/scripts/state.js#L223
Off the top of my head, assuming you will want to store this in a new table:
- Update database schema to create the new table
- Bump the schema version and write a migration for older versions of the database
- Update the
Message
entity to include the components - Update
SqliteDatabaseFile
to save/retrieve the components - Update the tracker so it sends the components to the local server
- Update
TrackMessagesEndpoint
to parse out the components from the request
If you want them in the viewer, you will also need to:
- Update
ViewerJsonExport
to include the components in the viewer file - Update the viewer scripts and styles to generate some UI for the components
For starters I won't add it to the viewer. It's not important, IMO.
The following is a note for myself.
- table can be added in https://github.com/chylex/Discord-History-Tracker/blob/master/app/Server/Database/Sqlite/Schema.cs pretty easily. only trouble is, that doesn't seem to be called on subsequent launches meaning the table wont exist if you're opening an existing db
- migration: line 26 of the aforementioned file checks for migration i think?
- message: this? https://github.com/chylex/Discord-History-Tracker/blob/master/app/Server/Data/Message.cs
- https://github.com/chylex/Discord-History-Tracker/blob/master/app/Server/Database/Sqlite/SqliteDatabaseFile.cs
- Tracker: no idea, will have to look at this folder https://github.com/chylex/Discord-History-Tracker/tree/master/app/Resources/Tracker/scripts
- state.js seems like a fair bet
- No idea, will have to check
only trouble is, that doesn't seem to be called on subsequent launches meaning the table wont exist if you're opening an existing db
That's why the migration system exists.
Yep, figured that otu later
I'm no longer using this scraping tool for Discord, so I probably won't be doing this (especially since I have zero experience with .NET). If anyone wants to pick this up, my notes in a previous comment might be a good starting point.
Closing in favor of #247.