Skip to content

feat(plugin): Export Contacts#2202

Closed
dat-insanity wants to merge 1 commit into
Vendicated:mainfrom
dat-insanity:main
Closed

feat(plugin): Export Contacts#2202
dat-insanity wants to merge 1 commit into
Vendicated:mainfrom
dat-insanity:main

Conversation

@dat-insanity
Copy link
Copy Markdown

A simple plugin that adds a export button to your friends tab on discord.
Discord_HwNovnJRc2

It exports it to your clipboard in a JSON format, and will export your added friends, incoming/outgoing friend requests, and blocked users.

@Vendicated
Copy link
Copy Markdown
Owner

what does this do that requesting your data package can't do?

@dat-insanity
Copy link
Copy Markdown
Author

nothing i believe, but requesting a data package takes time and has a rate limit (iirc). if you have multiple accounts and want to quickly back up your contacts, or if you change/delete accounts often, this could come in handy

{
find: "fetchRelationships(){",
replacement: {
match: /\.then\(e=>o\.default\.dispatch\({type:"LOAD_RELATIONSHIPS_SUCCESS",relationships:e\.body}\)/,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't hardcode variable names

find: "fetchRelationships(){",
replacement: {
match: /\.then\(e=>o\.default\.dispatch\({type:"LOAD_RELATIONSHIPS_SUCCESS",relationships:e\.body}\)/,
replace: ".then(e=>{o.default.dispatch({type:\"LOAD_RELATIONSHIPS_SUCCESS\",relationships:e.body}); $self.getContacts(e.body)}"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use match groups instead of copy pasting the matched stuff

find: "[role=\"tab\"][aria-disabled=\"false\"]",
replacement: {
match: /this\.props;return\(/,
replace: "this.props;console.log(a.Children);return("
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this patch

{
find: "[role=\"tab\"][aria-disabled=\"false\"]",
replacement: {
match: /(\w+)\.Children\.map\((\w+),\s*this\.renderChildren\)/,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use vencord's special \i to match identifiers


addExportButton() {
return <ErrorBoundary noop key=".2">
<button className="export-contacts-button" onClick={() => { this.copyContactToClipboard(); console.log("clicked"); }}>Export</button>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Discord's button component to be compatible with themes

}
// reason why you need to click the all tab is because the data is extracted during
// the request itself when you fetch all your friends. this is done to avoid sending a
// manual request to discord, which may raise suspicion and might even get you terminated.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be fine. just make sure you send the same request as discord normally would

@TheKodeToad
Copy link
Copy Markdown
Contributor

I think txt export would be pretty nice too but does Discord have a split button widget?

@Vendicated
Copy link
Copy Markdown
Owner

hi thanks a lot for your contribution! you havent addressed any of my feedback, are you still interested in working on this & getting it merged?

i'll be closing this for now but if you're still interested, feel free to comment and we can reopen this

@Vendicated Vendicated closed this May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants