Added CommandContext, fixed commands compile errors
This commit is contained in:
@@ -15,19 +15,30 @@ namespace Discord.Rest
|
||||
private ImmutableArray<ulong> _roleIds;
|
||||
|
||||
public string Nickname { get; private set; }
|
||||
public ulong GuildId { get; private set; }
|
||||
internal IGuild Guild { get; private set; }
|
||||
|
||||
public ulong GuildId => Guild.Id;
|
||||
public GuildPermissions GuildPermissions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Guild.Available)
|
||||
throw new InvalidOperationException("Resolving permissions requires the parent guild to be downloaded.");
|
||||
return new GuildPermissions(Permissions.ResolveGuild(Guild, this));
|
||||
}
|
||||
}
|
||||
public IReadOnlyCollection<ulong> RoleIds => _roleIds;
|
||||
|
||||
public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks);
|
||||
|
||||
internal RestGuildUser(BaseDiscordClient discord, ulong id)
|
||||
internal RestGuildUser(BaseDiscordClient discord, IGuild guild, ulong id)
|
||||
: base(discord, id)
|
||||
{
|
||||
Guild = guild;
|
||||
}
|
||||
internal static RestGuildUser Create(BaseDiscordClient discord, Model model)
|
||||
internal static RestGuildUser Create(BaseDiscordClient discord, IGuild guild, Model model)
|
||||
{
|
||||
var entity = new RestGuildUser(discord, model.User.Id);
|
||||
var entity = new RestGuildUser(discord, guild, model.User.Id);
|
||||
entity.Update(model);
|
||||
return entity;
|
||||
}
|
||||
@@ -41,7 +52,7 @@ namespace Discord.Rest
|
||||
private void UpdateRoles(ulong[] roleIds)
|
||||
{
|
||||
var roles = ImmutableArray.CreateBuilder<ulong>(roleIds.Length + 1);
|
||||
roles.Add(GuildId);
|
||||
roles.Add(Guild.Id);
|
||||
for (int i = 0; i < roleIds.Length; i++)
|
||||
roles.Add(roleIds[i]);
|
||||
_roleIds = roles.ToImmutable();
|
||||
@@ -56,12 +67,10 @@ namespace Discord.Rest
|
||||
|
||||
public ChannelPermissions GetPermissions(IGuildChannel channel)
|
||||
{
|
||||
throw new NotImplementedException(); //TODO: Impl
|
||||
var guildPerms = GuildPermissions;
|
||||
return new ChannelPermissions(Permissions.ResolveChannel(Guild, this, channel, guildPerms.RawValue));
|
||||
}
|
||||
|
||||
//IGuildUser
|
||||
IReadOnlyCollection<ulong> IGuildUser.RoleIds => RoleIds;
|
||||
|
||||
//IVoiceState
|
||||
bool IVoiceState.IsDeafened => false;
|
||||
bool IVoiceState.IsMuted => false;
|
||||
|
||||
Reference in New Issue
Block a user