Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support roles and permissions #6

Closed
brpeterman opened this issue Oct 14, 2015 · 1 comment
Closed

Support roles and permissions #6

brpeterman opened this issue Oct 14, 2015 · 1 comment

Comments

@brpeterman
Copy link
Owner

Roles in READY message:

        "roles": [
          {
            "position": -1,
            "permissions": 68608,
            "name": "@everyone",
            "id": "101863722082930688",
            "hoist": false,
            "color": 0
          },
          {
            "position": -1,
            "permissions": 66321439,
            "name": "admin",
            "id": "101883326079459328",
            "hoist": false,
            "color": 15158332
          },
          {
            "position": -1,
            "permissions": 36953088,
            "name": "member",
            "id": "101883580606607360",
            "hoist": false,
            "color": 0
          },
          {
            "position": -1,
            "permissions": 41155585,
            "name": "mod",
            "id": "102504105297059840",
            "hoist": false,
            "color": 3447003
          }
        ]

Roles for a single user:

        "members": [
          {
            "user": {
              "username": "Oyerth",
              "id": "101794296201494528",
              "discriminator": "2305",
              "avatar": "f220a1a41c2e2b3408f309d54753d7ae"
            },
            "roles": [
              "101883326079459328"
            ],
            "mute": false,
            "joined_at": "2015-10-09T02:10:04.260000+00:00",
            "deaf": false
          }

Permissions for a channel:

        "channels": [
          {
            "type": "text",
            "topic": "God damn it, Euix.",
            "position": 0,
            "permission_overwrites": [
              {
                "type": "role",
                "id": "101863722082930688",
                "deny": 0,
                "allow": 0
              }
            ],
            "name": "thelab",
            "last_message_id": "103705602961731584",
            "id": "101863722082930688"
          }

Role update:

{
  "t": "GUILD_ROLE_UPDATE",
  "s": 2,
  "op": 0,
  "d": {
    "role": {
      "position": -1,
      "permissions": 36953088,
      "name": "member",
      "id": "101883580606607360",
      "hoist": false,
      "color": 9936031
    },
    "guild_id": "101863722082930688"
  }
}

I assume GUILD_ROLE_CREATE and GUILD_ROLE_DELETE also exist, if they're anything like channels.

Role create:

{
  "t": "GUILD_ROLE_CREATE",
  "s": 8,
  "op": 0,
  "d": {
    "role": {
      "position": 4,
      "permissions": 36953089,
      "name": "new role",
      "id": "103923421166985216",
      "hoist": false,
      "color": 0
    },
    "guild_id": "101863722082930688"
  }
}

This is followed by a GUILD_ROLE_UPDATE to change the settings from their defaults.

Add role to member:

{
  "t": "GUILD_MEMBER_UPDATE",
  "s": 10,
  "op": 0,
  "d": {
    "user": {
      "username": "Overwatch",
      "id": "102899985732861952",
      "discriminator": "5470",
      "avatar": null
    },
    "roles": [
      "101883580606607360",
      "103923421166985216"
    ],
    "guild_id": "101863722082930688"
  }
}
@brpeterman
Copy link
Owner Author

The permissions int is probably just a bit mask. Need to determine which permissions are assigned to which bits.

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

No branches or pull requests

1 participant