Naleksuh Posted January 9, 2020 Report Posted January 9, 2020 How can I check if a user has a permissions? There doesn't seem to be any method for it at all. I can't even find out whether or not a user has a role or what that role would do. Specifically, I want to make a command only do something if a user has the "Add and Delete Channels" permissions Quote
Dr. McKay Posted January 9, 2020 Report Posted January 9, 2020 I've not verified whether this works, but reading over the docs it seems like this would be the way you'd check if a user has a given permission: Call setSessionActiveGroups on startup to get Chat Room Group State Record the Chat Room Member data from Chat Room Group State. This data includes member role IDs. Record the Chat Room Group Header State data from Chat Room Group State. This data includes Chat Role Actions. When you want to see if a member has the permission you want to check, look them up in the Chat Room Member list from Chat Room Group State, and see in Chat Role Actions if the roles that map to their role IDs include the permission you want to check. Quote
Naleksuh Posted January 9, 2020 Author Report Posted January 9, 2020 This does seem that it will technically work, but rather complex and inconsistent (i.e. data being changed after startup). I'd prefer if there was a direct method, i.e client.chat.userHasPermission(steamid64, chat_id, permission_string) , but I guess this is fine too. Could you consider adding it in a future version, though? Quote
Dr. McKay Posted January 9, 2020 Report Posted January 9, 2020 The only issue should be if you get a new moderator or if you change roles, although I grant that it would be ideal to not have those be issues at all. Eventually I'm sure I'll add some events to alert you when a new member joins, when a member's roles are updated, and when role permissions are updated. I'm not sure I'll ever end up adding a method like you suggest though, since that would require steam-user to keep knowledge of chat rooms' states (it doesn't currently), although I can see how that would be useful. Quote
Naleksuh Posted January 9, 2020 Author Report Posted January 9, 2020 Quote The only issue should be if you get a new moderator or if you change roles This is a public bot used intended for use in chat i don't moderate. Can't really act like that won't happen. Quote I'm not sure I'll ever end up adding a method like you suggest though, since that would require steam-user to keep knowledge of chat rooms' states (it doesn't currently), although I can see how that would be useful. Is there a problem with only tracking them when the needed method is called? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.