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

Creation of guild roles ends up creating "new role" #3

Closed
thorerik opened this issue Feb 5, 2017 · 2 comments
Closed

Creation of guild roles ends up creating "new role" #3

thorerik opened this issue Feb 5, 2017 · 2 comments

Comments

@thorerik
Copy link

thorerik commented Feb 5, 2017

I'm currently working on automating the configuration of a build, but when I call createGuildRole(), It doesn't seem to take the parameters I pass in.

For example:

/Users/thor/src/thor/discord-automation/src/Discord/Helpers.php:26:
array(5) {
  'name' =>
  string(9) "Developer"
  'permissions' =>
  int(2146958463)
  'color' =>
  int(16711680)
  'hoist' =>
  bool(true)
  'mentionable' =>
  bool(false)
}
[2017-02-05 22:29:05] Logger.INFO: https://discordapp.com/api/guilds/270558718985371648/roles POST /api/guilds/270558718985371648/roles HTTP/1.1 Authorization: Bot <TOKEN> User-Agent: DiscordBot (https://github.com/aequasi/php-restcord, 0.1.1 ) Host: discordapp.com   [] []
[2017-02-05 22:29:05] Logger.INFO: HTTP/1.1 200 OK Date: Sun, 05 Feb 2017 22:29:05 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: keep-alive <some Cloudflare headers>  {"hoist": false, "name": "new role", "mentionable": false, "color": 0, "position": 1, "id": "277928613678940161", "managed": false, "permissions": 104324161} [] []
/Users/thor/src/thor/discord-automation/src/Discord/Helpers.php:30:
class GuzzleHttp\Command\Result#158 (8) {
  public $hoist =>
  bool(false)
  public $name =>
  string(8) "new role"
  public $mentionable =>
  bool(false)
  public $color =>
  int(0)
  public $position =>
  int(1)
  public $id =>
  string(18) "277928613678940161"
  public $managed =>
  bool(false)
  public $permissions =>
  int(104324161)
}

I've wrapped it in a simple class, and call it as the following function:

public function createRole($roleData) {
        $role = [
            'name' => $roleData['name'],
            'permissions' => $roleData['permissions'],
            'color' => $roleData['color'],
            'hoist' => $roleData['hoist'],
            'mentionable' => $roleData['mentionable']
        ];

        echo "creating\n";

        var_dump($role);

        $foo = $this->discord->guild->createGuildRole(array_merge($this->settings, $role));

        var_dump($foo);
}

$this->settings contains ['guild.id' => 270558718985371648].

Moving it out of the wrapper doesn't change the behaviour either, and the parameters, as far as I can tell are correct (https://www.restcord.com/Guild/Create%20Guild%20Role/)

Am I just going crazy here or?

@cryptiklemur
Copy link
Contributor

Give the latest release a try

@thorerik
Copy link
Author

thorerik commented Feb 6, 2017

0.1.2 fixed that issue 👍

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

2 participants