示例#1
0
 /**
  * Moves the member to another voice channel.
  *
  * @param Channel|int $channel 
  * @return boolean 
  */
 public function moveMember($channel)
 {
     if ($channel instanceof Channel) {
         $channel = $channel->id;
     }
     Guzzle::patch("guilds/{$this->guild_id}/members/{$this->id}", ['channel_id' => $channel]);
     // At the moment we are unable to check if the member
     // was moved successfully.
     return true;
 }
示例#2
0
 /**
  * Moves a member to another voice channel.
  *
  * @param Member|int
  * @return boolean 
  */
 public function moveMember($member)
 {
     if ($this->type != self::TYPE_VOICE) {
         return false;
     }
     if ($member instanceof Member) {
         $member = $member->id;
     }
     Guzzle::patch("guilds/{$this->guild_id}/members/{$member}", ['channel_id' => $this->id]);
     // At the moment we are unable to check if the member
     // was moved successfully.
     return true;
 }
示例#3
0
 /**
  * Saves the part to the Discord servers.
  *
  * @return boolean 
  */
 public function save()
 {
     $attributes = $this->created ? $this->getUpdatableAttributes() : $this->getCreatableAttributes();
     try {
         if ($this->created) {
             if (!$this->editable) {
                 return false;
             }
             $request = Guzzle::patch($this->replaceWithVariables($this->uris['update']), $attributes);
         } else {
             if (!$this->creatable) {
                 return false;
             }
             $request = Guzzle::post($this->replaceWithVariables($this->uris['create']), $attributes);
             $this->created = true;
             $this->deleted = false;
         }
     } catch (\Exception $e) {
         throw new PartRequestFailedException($e->getMessage());
     }
     if ($this->fillAfterSave) {
         $this->fill($request);
     }
     return true;
 }