Browse Source

Added func GuildMemberMove, closes #92

Bruce Marriner 9 years ago
parent
commit
22bb771120
1 changed files with 21 additions and 0 deletions
  1. 21 0
      restapi.go

+ 21 - 0
restapi.go

@@ -465,6 +465,7 @@ func (s *Session) GuildMemberDelete(guildID, userID string) (err error) {
 // userID   : The ID of a User.
 // roles    : A list of role ID's to set on the member.
 func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err error) {
+
 	data := struct {
 		Roles []string `json:"roles"`
 	}{roles}
@@ -477,6 +478,26 @@ func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err e
 	return
 }
 
+// GuildMemberMove moves a guild member from one voice channel to another/none
+//  guildID   : The ID of a Guild.
+//  userID    : The ID of a User.
+//  channelID : The ID of a channel to move user to, or null?
+// NOTE : I am not entirely set on the name of this function and it may change
+// prior to the final 1.0.0 release of Discordgo
+func (s *Session) GuildMemberMove(guildID, userID, channelID string) (err error) {
+
+	data := struct {
+		ChannelID string `json:"channel_id"`
+	}{channelID}
+
+	_, err = s.Request("PATCH", GUILD_MEMBER(guildID, userID), data)
+	if err != nil {
+		return
+	}
+
+	return
+}
+
 // GuildChannels returns an array of Channel structures for all channels of a
 // given guild.
 // guildID   : The ID of a Guild.