public function edit($guildId, $options = []) { $image = new Image(); $guild = $this->show($guildId); $json['name'] = isset($options['name']) ? $options['name'] : $guild['name']; $json['region'] = isset($options['region']) ? $options['region'] : $guild['region']; $json['icon'] = isset($options['icon']) ? $image->encodeImage($options['icon']) : $guild['icon']; $json['afk_channel_id'] = isset($options['afk_channel_id']) ? $options['afk_channel_id'] : $guild['afk_channel_id']; return $this->request('PATCH', 'guilds/' . $guildId, ['json' => $json]); }
/** * @param $email * @param $password * @param null $username * @param null $new_password * @param null $avatar * @return mixed|\Psr\Http\Message\StreamInterface */ public function edit($email, $password, $username = null, $new_password = null, $avatar = null) { $image = new Image(); $me = $this->me(); $json['username'] = is_null($username) ? $me['username'] : $username; $json['avatar'] = is_null($avatar) ? $me['avatar'] : $image->encodeImage($avatar); $json['email'] = $email; $json['password'] = $password; $json['new_password'] = is_null($new_password) ? '' : $new_password; return $this->request('PATCH', 'users/@me', ['json' => $json]); }