Esempio n. 1
0
        /// <summary>
        /// Changes a user's voice state in the specified guild
        /// </summary>
        /// <param name="guildId">ID of the guild</param>
        /// <param name="userId">ID of the user</param>
        /// <param name="muted">Whether the member should be muted or not (null for 'don't change')</param>
        /// <param name="deafened">Whether the member should be deafened or not (null for 'don't change')</param>
        public static void ChangeGuildMemberVoiceState(this DiscordClient client, ulong guildId, ulong userId, bool?muted = null, bool?deafened = null)
        {
            GuildMemberProperties properties = new GuildMemberProperties();

            if (muted != null)
            {
                properties.Muted = muted.Value;
            }
            if (deafened != null)
            {
                properties.Deafened = deafened.Value;
            }
            client.ModifyGuildMember(guildId, userId, properties);
        }
Esempio n. 2
0
        public async Task ModifyAsync(GuildMemberProperties properties)
        {
            await Client.ModifyGuildMemberAsync(GuildId, User.Id, properties);

            if (properties.NickProperty.Set)
            {
                Nickname = properties.Nickname;
            }

            if (properties.RoleProperty.Set)
            {
                Roles = properties.Roles;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Modifies the specified guild member
 /// </summary>
 /// <param name="properties">Things to change</param>
 public void Modify(GuildMemberProperties properties)
 {
     ModifyAsync(properties).GetAwaiter().GetResult();
 }
Esempio n. 4
0
 /// <summary>
 /// Modifies the specified guild member
 /// </summary>
 /// <param name="properties">Things to change</param>
 public void Modify(GuildMemberProperties properties)
 {
     Client.ModifyGuildMember(GuildId, User.Id, properties);
 }
Esempio n. 5
0
 internal static void ModifyGuildMember(this DiscordClient client, ulong guildId, ulong userId, GuildMemberProperties properties)
 {
     client.HttpClient.Patch($"/guilds/{guildId}/members/{userId}", JsonConvert.SerializeObject(properties));
 }
Esempio n. 6
0
 /// <summary>
 /// Modifies the specified guild member
 /// </summary>
 /// <param name="guildId">ID of the guild</param>
 /// <param name="userId">ID of the user</param>
 /// <param name="properties">Things to change</param>
 public static void ModifyGuildMember(this DiscordClient client, ulong guildId, ulong userId, GuildMemberProperties properties)
 {
     client.HttpClient.Patch($"/guilds/{guildId}/members/{userId}", properties);
 }
Esempio n. 7
0
 public static void ModifyGuildMember(this DiscordClient client, ulong guildId, ulong userId, GuildMemberProperties properties)
 {
     client.ModifyGuildMemberAsync(guildId, userId, properties).GetAwaiter().GetResult();
 }
Esempio n. 8
0
 public static async Task ModifyGuildMemberAsync(this DiscordClient client, ulong guildId, ulong userId, GuildMemberProperties properties)
 {
     await client.HttpClient.PatchAsync($"/guilds/{guildId}/members/{userId}", properties);
 }