Browse Source

Syntax cleanup

tags/docs-0.9
Brandon Smith 9 years ago
parent
commit
b5c37b0986
8 changed files with 50 additions and 50 deletions
  1. +3
    -3
      Discord.Net/Channel.cs
  2. +7
    -7
      Discord.Net/DiscordClient.cs
  3. +4
    -4
      Discord.Net/Invite.cs
  4. +3
    -3
      Discord.Net/Membership.cs
  5. +3
    -3
      Discord.Net/Message.cs
  6. +21
    -21
      Discord.Net/Role.cs
  7. +8
    -8
      Discord.Net/Server.cs
  8. +1
    -1
      Discord.Net/User.cs

+ 3
- 3
Discord.Net/Channel.cs View File

@@ -18,14 +18,14 @@ namespace Discord
public string ServerId { get; }
[JsonIgnore]
public Server Server { get { return ServerId != null ? _client.GetServer(ServerId) : null; } }
public Server Server => ServerId != null ? _client.GetServer(ServerId) : null;

[JsonIgnore]
public string RecipientId { get; internal set; }
public User Recipient { get { return _client.GetUser(RecipientId); } }
public User Recipient => _client.GetUser(RecipientId);

[JsonIgnore]
public IEnumerable<Message> Messages { get { return _client.Messages.Where(x => x.ChannelId == Id); } }
public IEnumerable<Message> Messages => _client.Messages.Where(x => x.ChannelId == Id);

//Not Implemented
public object[] PermissionOverwrites { get; internal set; }


+ 7
- 7
Discord.Net/DiscordClient.cs View File

@@ -21,24 +21,24 @@ namespace Discord
private bool _isClosing, _isReady;

public string UserId { get; private set; }
public User User { get { return _users[UserId]; } }
public User User => _users[UserId];

public IEnumerable<User> Users { get { return _users; } }
public IEnumerable<User> Users => _users;
private AsyncCache<User, API.Models.UserReference> _users;

public IEnumerable<Server> Servers { get { return _servers; } }
public IEnumerable<Server> Servers => _servers;
private AsyncCache<Server, API.Models.ServerReference> _servers;

public IEnumerable<Channel> Channels { get { return _channels; } }
public IEnumerable<Channel> Channels => _channels;
private AsyncCache<Channel, API.Models.ChannelReference> _channels;

public IEnumerable<Message> Messages { get { return _messages; } }
public IEnumerable<Message> Messages => _messages;
private AsyncCache<Message, API.Models.MessageReference> _messages;

public IEnumerable<Role> Roles { get { return _roles; } }
public IEnumerable<Role> Roles => _roles;
private AsyncCache<Role, API.Models.Role> _roles;

public bool IsConnected { get { return _isReady; } }
public bool IsConnected => _isReady;

public DiscordClient()
{


+ 4
- 4
Discord.Net/Invite.cs View File

@@ -10,19 +10,19 @@ namespace Discord
public bool IsRevoked, IsTemporary;
public readonly string Code, XkcdPass;

public string Url { get { return API.Endpoints.InviteUrl(XkcdPass ?? Code); } }
public string Url => API.Endpoints.InviteUrl(XkcdPass ?? Code);

public string InviterId { get; internal set; }
[JsonIgnore]
public User Inviter { get { return _client.GetUser(InviterId); } }
public User Inviter => _client.GetUser(InviterId);

public string ServerId { get; internal set; }
[JsonIgnore]
public Server Server { get { return _client.GetServer(ServerId); } }
public Server Server => _client.GetServer(ServerId);

public string ChannelId { get; internal set; }
[JsonIgnore]
public Channel Channel { get { return _client.GetChannel(ChannelId); } }
public Channel Channel => _client.GetChannel(ChannelId);

internal Invite(string code, string xkcdPass, DiscordClient client)
{


+ 3
- 3
Discord.Net/Membership.cs View File

@@ -14,13 +14,13 @@ namespace Discord
public bool IsDeafened { get; internal set; }

public string ServerId { get; }
public Server Server { get { return _client.GetServer(ServerId); } }
public Server Server => _client.GetServer(ServerId);

public string UserId { get; }
public User User { get { return _client.GetUser(UserId); } }
public User User => _client.GetUser(UserId);
public string[] RoleIds { get; internal set; }
public IEnumerable<Role> Roles { get { return RoleIds.Select(x => _client.GetRole((string)x)); } }
public IEnumerable<Role> Roles => RoleIds.Select(x => _client.GetRole(x));

public Membership(string serverId, string userId, DateTime joinedAt, DiscordClient client)
{


+ 3
- 3
Discord.Net/Message.cs View File

@@ -18,15 +18,15 @@ namespace Discord

public string[] MentionIds { get; internal set; }
[JsonIgnore]
public IEnumerable<User> Mentions { get { return MentionIds.Select(x => _client.GetUser(x)).Where(x => x != null); } }
public IEnumerable<User> Mentions => MentionIds.Select(x => _client.GetUser(x)).Where(x => x != null);

public string ChannelId { get; }
[JsonIgnore]
public Channel Channel { get { return _client.GetChannel(ChannelId); } }
public Channel Channel => _client.GetChannel(ChannelId);

public string UserId { get; internal set; }
[JsonIgnore]
public User User { get { return _client.GetUser(UserId); } }
public User User => _client.GetUser(UserId);
//Not Implemented
public object[] Attachments { get; internal set; }


+ 21
- 21
Discord.Net/Role.cs View File

@@ -11,28 +11,28 @@ namespace Discord

public PackedPermissions() { }
public bool General_CreateInstantInvite { get { return ((_rawValue >> 0) & 0x1) == 1; } }
public bool General_BanMembers { get { return ((_rawValue >> 1) & 0x1) == 1; } }
public bool General_KickMembers { get { return ((_rawValue >> 2) & 0x1) == 1; } }
public bool General_ManageRoles { get { return ((_rawValue >> 3) & 0x1) == 1; } }
public bool General_ManageChannels { get { return ((_rawValue >> 4) & 0x1) == 1; } }
public bool General_ManageServer { get { return ((_rawValue >> 5) & 0x1) == 1; } }
public bool General_CreateInstantInvite => ((_rawValue >> 0) & 0x1) == 1;
public bool General_BanMembers => ((_rawValue >> 1) & 0x1) == 1;
public bool General_KickMembers => ((_rawValue >> 2) & 0x1) == 1;
public bool General_ManageRoles => ((_rawValue >> 3) & 0x1) == 1;
public bool General_ManageChannels => ((_rawValue >> 4) & 0x1) == 1;
public bool General_ManageServer => ((_rawValue >> 5) & 0x1) == 1;
//4 Unused
public bool Text_ReadMessages { get { return ((_rawValue >> 10) & 0x1) == 1; } }
public bool Text_SendMessages { get { return ((_rawValue >> 11) & 0x1) == 1; } }
public bool Text_SendTTSMessages { get { return ((_rawValue >> 12) & 0x1) == 1; } }
public bool Text_ManageMessages { get { return ((_rawValue >> 13) & 0x1) == 1; } }
public bool Text_EmbedLinks { get { return ((_rawValue >> 14) & 0x1) == 1; } }
public bool Text_AttachFiles { get { return ((_rawValue >> 15) & 0x1) == 1; } }
public bool Text_ReadMessageHistory { get { return ((_rawValue >> 16) & 0x1) == 1; } }
public bool Text_MentionEveryone { get { return ((_rawValue >> 17) & 0x1) == 1; } }
public bool Text_ReadMessages => ((_rawValue >> 10) & 0x1) == 1;
public bool Text_SendMessages => ((_rawValue >> 11) & 0x1) == 1;
public bool Text_SendTTSMessages => ((_rawValue >> 12) & 0x1) == 1;
public bool Text_ManageMessages => ((_rawValue >> 13) & 0x1) == 1;
public bool Text_EmbedLinks => ((_rawValue >> 14) & 0x1) == 1;
public bool Text_AttachFiles => ((_rawValue >> 15) & 0x1) == 1;
public bool Text_ReadMessageHistory => ((_rawValue >> 16) & 0x1) == 1;
public bool Text_MentionEveryone => ((_rawValue >> 17) & 0x1) == 1;
//2 Unused
public bool Voice_Connect { get { return ((_rawValue >> 20) & 0x1) == 1; } }
public bool Voice_Speak { get { return ((_rawValue >> 21) & 0x1) == 1; } }
public bool Voice_MuteMembers { get { return ((_rawValue >> 22) & 0x1) == 1; } }
public bool Voice_DeafenMembers { get { return ((_rawValue >> 23) & 0x1) == 1; } }
public bool Voice_MoveMembers { get { return ((_rawValue >> 24) & 0x1) == 1; } }
public bool Voice_UseVoiceActivation { get { return ((_rawValue >> 25) & 0x1) == 1; } }
public bool Voice_Connect => ((_rawValue >> 20) & 0x1) == 1;
public bool Voice_Speak => ((_rawValue >> 21) & 0x1) == 1;
public bool Voice_MuteMembers => ((_rawValue >> 22) & 0x1) == 1;
public bool Voice_DeafenMembers => ((_rawValue >> 23) & 0x1) == 1;
public bool Voice_MoveMembers => ((_rawValue >> 24) & 0x1) == 1;
public bool Voice_UseVoiceActivation => ((_rawValue >> 25) & 0x1) == 1;
//6 Unused
}

@@ -45,7 +45,7 @@ namespace Discord

public string ServerId { get; }
[JsonIgnore]
public Server Server { get { return _client.GetServer(ServerId); } }
public Server Server => _client.GetServer(ServerId);

internal Role(string id, string serverId, DiscordClient client)
{


+ 8
- 8
Discord.Net/Server.cs View File

@@ -18,20 +18,20 @@ namespace Discord
public string Region { get; internal set; }
public string OwnerId { get; internal set; }
public User Owner { get { return _client.GetUser(OwnerId); } }
public bool IsOwner { get { return _client.UserId == OwnerId; } }
public User Owner => _client.GetUser(OwnerId);
public bool IsOwner => _client.UserId == OwnerId;
public string DefaultChannelId { get { return Id; } }
public Channel DefaultChannel { get { return _client.GetChannel(DefaultChannelId); } }
public string DefaultChannelId => Id;
public Channel DefaultChannel =>_client.GetChannel(DefaultChannelId);

internal ConcurrentDictionary<string, Membership> _members;
public IEnumerable<Membership> Members { get { return _members.Values; } }
public IEnumerable<Membership> Members => _members.Values;

internal ConcurrentDictionary<string, bool> _bans;
public IEnumerable<User> Bans { get { return _bans.Keys.Select(x => _client.GetUser(x)); } }
public IEnumerable<User> Bans => _bans.Keys.Select(x => _client.GetUser(x));

public IEnumerable<Channel> Channels { get { return _client.Channels.Where(x => x.ServerId == Id); } }
public IEnumerable<Role> Roles { get { return _client.Roles.Where(x => x.ServerId == Id); } }
public IEnumerable<Channel> Channels => _client.Channels.Where(x => x.ServerId == Id);
public IEnumerable<Role> Roles => _client.Roles.Where(x => x.ServerId == Id);

//Not Implemented
public object Presence { get; internal set; }


+ 1
- 1
Discord.Net/User.cs View File

@@ -12,7 +12,7 @@ namespace Discord
public string Name { get; internal set; }

public string AvatarId { get; internal set; }
public string AvatarUrl { get { return Endpoints.UserAvatar(Id, AvatarId); } }
public string AvatarUrl => Endpoints.UserAvatar(Id, AvatarId);
public string Discriminator { get; internal set; }
[JsonIgnore]
public string Email { get; internal set; }


Loading…
Cancel
Save