docstrings for modify params, minor bugfixes
This commit is contained in:
@@ -64,7 +64,14 @@ namespace Discord.Rest
|
||||
public static async Task<IReadOnlyCollection<RoleModel>> ModifyRolesAsync(IGuild guild, BaseDiscordClient client,
|
||||
IEnumerable<ModifyGuildRolesParams> args, RequestOptions options)
|
||||
{
|
||||
var apiArgs = args.Select(x => new API.Rest.ModifyGuildRolesParams(x.Id) { Color = x.Color, Hoist = x.Hoist, Name = x.Name, Permissions = x.Permissions, Position = x.Position });
|
||||
var apiArgs = args.Select(x => new API.Rest.ModifyGuildRolesParams(x.Id)
|
||||
{
|
||||
Color = x.Color.IsSpecified ? x.Color.Value.RawValue : Optional.Create<uint>(),
|
||||
Hoist = x.Hoist,
|
||||
Name = x.Name,
|
||||
Permissions = x.Permissions.IsSpecified ? x.Permissions.Value.RawValue : Optional.Create<ulong>(),
|
||||
Position = x.Position
|
||||
});
|
||||
return await client.ApiClient.ModifyGuildRolesAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
|
||||
}
|
||||
public static async Task LeaveAsync(IGuild guild, BaseDiscordClient client,
|
||||
@@ -167,8 +174,8 @@ namespace Discord.Rest
|
||||
await role.ModifyAsync(x =>
|
||||
{
|
||||
x.Name = name;
|
||||
x.Permissions = (permissions ?? role.Permissions).RawValue;
|
||||
x.Color = (color ?? Color.Default).RawValue;
|
||||
x.Permissions = (permissions ?? role.Permissions);
|
||||
x.Color = (color ?? Color.Default);
|
||||
x.Hoist = isHoisted;
|
||||
}, options).ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ namespace Discord.Rest
|
||||
func(args);
|
||||
var apiArgs = new API.Rest.ModifyGuildRoleParams
|
||||
{
|
||||
Color = args.Color,
|
||||
Color = args.Color.IsSpecified ? args.Color.Value.RawValue : Optional.Create<uint>(),
|
||||
Hoist = args.Hoist,
|
||||
Name = args.Name,
|
||||
Permissions = args.Permissions,
|
||||
Permissions = args.Permissions.IsSpecified ? args.Permissions.Value.RawValue : Optional.Create<ulong>(),
|
||||
Position = args.Position
|
||||
};
|
||||
return await client.ApiClient.ModifyGuildRoleAsync(role.Guild.Id, role.Id, apiArgs, options).ConfigureAwait(false);
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using Model = Discord.API.User;
|
||||
using ImageModel = Discord.API.Image;
|
||||
using System.Linq;
|
||||
|
||||
namespace Discord.Rest
|
||||
{
|
||||
@@ -27,11 +28,11 @@ namespace Discord.Rest
|
||||
func(args);
|
||||
var apiArgs = new API.Rest.ModifyGuildMemberParams
|
||||
{
|
||||
ChannelId = args.ChannelId,
|
||||
ChannelId = args.Channel.IsSpecified ? args.Channel.Value.Id : Optional.Create<ulong>(),
|
||||
Deaf = args.Deaf,
|
||||
Mute = args.Mute,
|
||||
Nickname = args.Nickname,
|
||||
RoleIds = args.RoleIds
|
||||
RoleIds = args.Roles.IsSpecified ? args.Roles.Value.Select(r => r.Id).ToArray() : Optional.Create<ulong[]>(),
|
||||
};
|
||||
await client.ApiClient.ModifyGuildMemberAsync(user.GuildId, user.Id, apiArgs, options).ConfigureAwait(false);
|
||||
return args;
|
||||
|
||||
Reference in New Issue
Block a user