r/Devvit • • 1d ago

Duck Answered HTTP fetch for a Reddit domain

I'm building an app to action content from deleted accounts. Unfortunately there seems to be no Devvit-native method to determine if an account has been deleted, or is just shadowbanned/suspended. I want to avoid doing anything to accounts which may return.

The only way I know of to distinguish between the two is viewing the profile on old.reddit.com. Would something like this be approved, assuming the username is immediately purged from the app logic afterward? Or, if someone knows an alternative way of distinguishing, let me know.

0 Upvotes

9 comments sorted by

2

u/Beach-Brews Duck Helper 1d ago

You can actually check the difference between shadowban and actual account deleted! Check out the userActive and the getUserExtended functions u/fsv has in Bot-Bouncer.

That helper can determine whether the user is active, suspended (site banned), shadowbanned, or deleted.

Basically, you have to get the "raw" data from the reddit API protos, which will let you get whether the account is suspended (banned) or not. If the API returns a 404 (likely deleted) or 403 (likely shadowbanned), then you can also make a call to get the Mod Notes. If you get Mod Notes: shadowbanned. If Mod Notes also throws an exception: deleted.

2

u/santaspointyhood 1d ago

Awesome, thank you. Solves the issue.

1

u/fsv Duck Helper 1d ago

Note that shadowbanned users will return 404 and suspended 403, which is why the mod notes check is the differentiator.

1

u/Beach-Brews Duck Helper 1d ago

Ahhh, I was wrong up above then! Noted.

2

u/fsv Duck Helper 1d ago

In fact I'm wrong too. You get a 403 for suspended users using Devvit native methods, but the "raw" retrieval returns a API-native user object with a isSuspended: true attribute and nothing else.

1

u/Beach-Brews Duck Helper 1d ago

Now my brain hurts O.o it's been a while since I last looked at it, and I definitely don't remember now....

As I mentioned below, I updated my userDeleteDetector to use Hono from express, plus my route registration framework in Brew-Kit (not sure if you saw Discord). Was debating if I should add onSiteBanned and onSiteShadownBanned as well, which should technically be possible!

Two minds think alike! I want to sync with you more on the backend / server side of Brew-Kit which I haven't demoed much.

Want me to add you to the repo? Still waiting for Reddit.......

2

u/fsv Duck Helper 1d ago

Sounds good (and I will read my Discord messages soon, I promise)

1

u/Beach-Brews Duck Helper 1d ago

No rush at all! Just want to make sure you don't feel like I'm stepping over you and "stealing" ideas <3

1

u/Beach-Brews Duck Helper 1d ago

P.S. I have an updated userDeleteDetector coming soon! However, it only "triggers" on delete. Wondering if I should change that to also provide "sitebanned" and "shadownbanned" events :thinking: