#Member Guild Permissions via API

33 messages · Page 1 of 1 (latest)

lavish sonnet
#

Is there a reason the discord-api-types package does not contain any of the optional values returned by the Discord API? I am trying to use permissions off a guild member, but my typescript is throwing a fit because the package does not include permissions on the type. Discord documentation has permissions as optional.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

sullen lintelBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
lavish sonnet
#

this is a discordjs maintained package so im hoping some people are versed on it

compact bison
#

Show your code where you have that issue. Or at least state what type you refer to

lavish sonnet
#

discord's official documentation has permissions as optional

mostly curious why the discord-api-types package has absolutely no optional values in it

compact bison
#

returned when in the interaction object
And there’s a subtype of APIGuildMember for that

compact bison
lavish sonnet
#

didnt see the subtype
makes more sense now that I look at how it's split up

#

well now im curious as to how I'm supposed to get a member's overall permissions via api

compact bison
#

In what case do you need to do that?

lavish sonnet
#

administrator, manage server, etc.

#

essentially trying to check if a user can make certain changes to the server itself

compact bison
#

No, I don’t mean what permissions. I mean what’s the use case?

#

In context of a bot?

lavish sonnet
#

in the sense that I need to limit a user's access to certain features if they aren't an administrator

#

and from outside of a bot, just using the bot's credentials

compact bison
#

Then it‘s from a bot context. But how does that user authenticate who they are? OAuth2?

lavish sonnet
#

it's for a website independent of the bot
user logs in with oauth, site pulls certain guild details through the bot's credentials, then needs to determine what the user has access to
the site then makes configuration changes

#

everything works aside from figuring out what guild-level permissions the user has

compact bison
#

If they login with OAuth2 then use that to get the guild and member information of that user. Not the bot credentials

lavish sonnet
#

I still need to be able to pull it through the id, not solely oauth

compact bison
#

Why? Who needs to do that pull if they aren’t authenticated via OAuth2?

lavish sonnet
#

Member Guild Permissions via API

compact bison
#

Then it would have to fetch the roles and calculate the permissions by hierarchy from that. Or have an API on your bot process your website can query for that since the bot process has that information cached already

lavish sonnet
#

I was doing that before and wanted to avoid relying on the bot being online, but I'll look into the role stuff

compact bison
#

Well, I still don’t understand when the server needs to fetch that information without a user actually being logged in and using the website

lavish sonnet
#

I've got a way to mimic a user for debugging, but that only works when the server doesn't need oauth

#

everything is id based rather than oauth

compact bison
#

That sounds like a security issue in itself. As in someone might easily find a way to act as someone with another id although their OAuth2 doesn’t match

lavish sonnet
#

server validates it off the actual logged in user
it mimics certain access, not the entire site