@@ -1,32 +0,0 @@ | |||||
using System; | |||||
namespace Discord | |||||
{ | |||||
public partial class DiscordClient | |||||
{ | |||||
public event EventHandler Ready = delegate { }; | |||||
public event EventHandler<ChannelEventArgs> ChannelCreated = delegate { }; | |||||
public event EventHandler<ChannelEventArgs> ChannelDestroyed = delegate { }; | |||||
public event EventHandler<ChannelUpdatedEventArgs> ChannelUpdated = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageAcknowledged = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageDeleted = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageReceived = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageSent = delegate { }; | |||||
public event EventHandler<MessageUpdatedEventArgs> MessageUpdated = delegate { }; | |||||
public event EventHandler<ProfileUpdatedEventArgs> ProfileUpdated = delegate { }; | |||||
public event EventHandler<RoleEventArgs> RoleCreated = delegate { }; | |||||
public event EventHandler<RoleUpdatedEventArgs> RoleUpdated = delegate { }; | |||||
public event EventHandler<RoleEventArgs> RoleDeleted = delegate { }; | |||||
public event EventHandler<ServerEventArgs> JoinedServer = delegate { }; | |||||
public event EventHandler<ServerEventArgs> LeftServer = delegate { }; | |||||
public event EventHandler<ServerEventArgs> ServerAvailable = delegate { }; | |||||
public event EventHandler<ServerUpdatedEventArgs> ServerUpdated = delegate { }; | |||||
public event EventHandler<ServerEventArgs> ServerUnavailable = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserBanned = delegate { }; | |||||
public event EventHandler<TypingEventArgs> UserIsTyping = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserJoined = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserLeft = delegate { }; | |||||
public event EventHandler<UserUpdatedEventArgs> UserUpdated = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserUnbanned = delegate { }; | |||||
} | |||||
} |
@@ -5,15 +5,39 @@ using Newtonsoft.Json; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.IO; | using System.IO; | ||||
using System.Net; | |||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Provides a connection to the DiscordApp service. </summary> | /// <summary> Provides a connection to the DiscordApp service. </summary> | ||||
public partial class DiscordClient : IDisposable | |||||
public class DiscordClient : IDisposable | |||||
{ | { | ||||
public event EventHandler Ready = delegate { }; | |||||
public event EventHandler<ChannelEventArgs> ChannelCreated = delegate { }; | |||||
public event EventHandler<ChannelUpdatedEventArgs> ChannelUpdated = delegate { }; | |||||
public event EventHandler<ChannelEventArgs> ChannelDestroyed = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageAcknowledged = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageDeleted = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageReceived = delegate { }; | |||||
public event EventHandler<MessageEventArgs> MessageSent = delegate { }; | |||||
public event EventHandler<MessageUpdatedEventArgs> MessageUpdated = delegate { }; | |||||
public event EventHandler<ProfileUpdatedEventArgs> ProfileUpdated = delegate { }; | |||||
public event EventHandler<RoleEventArgs> RoleCreated = delegate { }; | |||||
public event EventHandler<RoleUpdatedEventArgs> RoleUpdated = delegate { }; | |||||
public event EventHandler<RoleEventArgs> RoleDeleted = delegate { }; | |||||
public event EventHandler<ServerEventArgs> JoinedServer = delegate { }; | |||||
public event EventHandler<ServerEventArgs> LeftServer = delegate { }; | |||||
public event EventHandler<ServerEventArgs> ServerAvailable = delegate { }; | |||||
public event EventHandler<ServerUpdatedEventArgs> ServerUpdated = delegate { }; | |||||
public event EventHandler<ServerEventArgs> ServerUnavailable = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserBanned = delegate { }; | |||||
public event EventHandler<TypingEventArgs> UserIsTyping = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserJoined = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserLeft = delegate { }; | |||||
public event EventHandler<UserUpdatedEventArgs> UserUpdated = delegate { }; | |||||
public event EventHandler<UserEventArgs> UserUnbanned = delegate { }; | |||||
public DiscordConfig Config { get; } | public DiscordConfig Config { get; } | ||||
public RestClient ClientAPI { get; } | public RestClient ClientAPI { get; } | ||||
public RestClient StatusAPI { get; } | public RestClient StatusAPI { get; } | ||||
@@ -3,32 +3,34 @@ using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
public struct PermissionOverwriteEntry | |||||
{ | |||||
public PermissionTarget TargetType { get; } | |||||
public ulong TargetId { get; } | |||||
public OverwritePermissions Permissions { get; } | |||||
} | |||||
public interface IPublicChannel : IChannel | public interface IPublicChannel : IChannel | ||||
{ | { | ||||
/// <summary> Gets the server this channel is a member of. </summary> | /// <summary> Gets the server this channel is a member of. </summary> | ||||
Server Server { get; } | Server Server { get; } | ||||
/// <summary> Gets a collection of permission overwrites for this channel. </summary> | /// <summary> Gets a collection of permission overwrites for this channel. </summary> | ||||
IEnumerable<PermissionOverwrite> PermissionOverwrites { get; } | |||||
IEnumerable<PermissionOverwriteEntry> PermissionOverwrites { get; } | |||||
/// <summary> Gets the name of this public channel. </summary> | /// <summary> Gets the name of this public channel. </summary> | ||||
string Name { get; } | string Name { get; } | ||||
/// <summary> Gets the position of this public channel relative to others of the same type. </summary> | /// <summary> Gets the position of this public channel relative to others of the same type. </summary> | ||||
int Position { get; } | |||||
int Position { get; } | |||||
/// <summary> Gets the permission overwrite for a specific user, or null if one does not exist. </summary> | /// <summary> Gets the permission overwrite for a specific user, or null if one does not exist. </summary> | ||||
PermissionOverwrite? GetPermissionOverwrite(User user); | |||||
OverwritePermissions? GetPermissionOverwrite(User user); | |||||
/// <summary> Gets the permission overwrite for a specific role, or null if one does not exist. </summary> | /// <summary> Gets the permission overwrite for a specific role, or null if one does not exist. </summary> | ||||
PermissionOverwrite? GetPermissionOverwrite(Role role); | |||||
OverwritePermissions? GetPermissionOverwrite(Role role); | |||||
/// <summary> Downloads a collection of all invites to this server. </summary> | /// <summary> Downloads a collection of all invites to this server. </summary> | ||||
Task<IEnumerable<Invite>> GetInvites(); | Task<IEnumerable<Invite>> GetInvites(); | ||||
/// <summary> Adds or updates the permission overwrite for the given user. </summary> | /// <summary> Adds or updates the permission overwrite for the given user. </summary> | ||||
Task UpdatePermissionOverwrite(User user, ChannelPermissions allow, ChannelPermissions deny); | |||||
/// <summary> Adds or updates the permission overwrite for the given user. </summary> | |||||
Task UpdatePermissionOverwrite(User user, TriStateChannelPermissions permissions); | |||||
/// <summary> Adds or updates the permission overwrite for the given role. </summary> | |||||
Task UpdatePermissionOverwrite(Role role, ChannelPermissions allow, ChannelPermissions deny); | |||||
Task UpdatePermissionOverwrite(User user, OverwritePermissions permissions); | |||||
/// <summary> Adds or updates the permission overwrite for the given role. </summary> | /// <summary> Adds or updates the permission overwrite for the given role. </summary> | ||||
Task UpdatePermissionOverwrite(Role role, TriStateChannelPermissions permissions); | |||||
Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions); | |||||
/// <summary> Removes the permission overwrite for the given user, if one exists. </summary> | /// <summary> Removes the permission overwrite for the given user, if one exists. </summary> | ||||
Task RemovePermissionOverwrite(User user); | Task RemovePermissionOverwrite(User user); | ||||
/// <summary> Removes the permission overwrite for the given role, if one exists. </summary> | /// <summary> Removes the permission overwrite for the given role, if one exists. </summary> | ||||
@@ -11,7 +11,7 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public DiscordClient Discord { get; } | public DiscordClient Discord { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ModelState State { get; } | |||||
public EntityState State { get; } | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ChannelType Type { get; } | public ChannelType Type { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -22,14 +22,12 @@ namespace Discord | |||||
public bool IsText => true; | public bool IsText => true; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public bool IsVoice => false; | public bool IsVoice => false; | ||||
/// <inheritdoc /> | |||||
public Server Server { get; } | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public User Recipient { get; } | public User Recipient { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<IEnumerable<User>> GetUsers(); | |||||
public Task<IEnumerable<User>> GetUsers() => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<Message> GetMessage(ulong id) => null; | public Task<Message> GetMessage(ulong id) => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -46,10 +44,10 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task SendIsTyping() => null; | public Task SendIsTyping() => null; | ||||
/// <inheritdoc /> | |||||
public Task Delete() => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task Update() => null; | public Task Update() => null; | ||||
/// <inheritdoc /> | |||||
public Task Delete() => null; | |||||
} | } | ||||
} | } |
@@ -19,7 +19,7 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public DiscordClient Discord { get; } | public DiscordClient Discord { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ModelState State { get; } | |||||
public EntityState State { get; } | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ChannelType Type => ChannelType.Public | ChannelType.Text; | public ChannelType Type => ChannelType.Public | ChannelType.Text; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -42,14 +42,14 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Server Server { get; } | public Server Server { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public IEnumerable<PermissionOverwrite> PermissionOverwrites { get; } | |||||
public IEnumerable<PermissionOverwriteEntry> PermissionOverwrites { get; } | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public IEnumerable<User> Users { get; } | public IEnumerable<User> Users { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public PermissionOverwrite? GetPermissionOverwrite(User user) => null; | |||||
public OverwritePermissions? GetPermissionOverwrite(User user) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public PermissionOverwrite? GetPermissionOverwrite(Role role) => null; | |||||
public OverwritePermissions? GetPermissionOverwrite(Role role) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<IEnumerable<User>> GetUsers() => null; | public Task<IEnumerable<User>> GetUsers() => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -60,15 +60,11 @@ namespace Discord | |||||
public Task<IEnumerable<Message>> GetMessages(int limit = 100, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before) => null; | public Task<IEnumerable<Message>> GetMessages(int limit = 100, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before) => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<IEnumerable<Invite>> GetInvites() => null; | public Task<IEnumerable<Invite>> GetInvites() => null; | ||||
/// <inheritdoc /> | |||||
public Task UpdatePermissionOverwrite(User user, ChannelPermissions allow, ChannelPermissions deny) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task UpdatePermissionOverwrite(User user, TriStateChannelPermissions permissions) => null; | |||||
public Task UpdatePermissionOverwrite(User user, OverwritePermissions permissions) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task UpdatePermissionOverwrite(Role role, ChannelPermissions allow, ChannelPermissions deny) => null; | |||||
/// <inheritdoc /> | |||||
public Task UpdatePermissionOverwrite(Role role, TriStateChannelPermissions permissions) => null; | |||||
public Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task RemovePermissionOverwrite(User user) => null; | public Task RemovePermissionOverwrite(User user) => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -87,11 +83,11 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null; | public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null; | ||||
/// <inheritdoc /> | |||||
public Task Delete() => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task Update() => null; | public Task Update() => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task Modify(Action<Properties> func) => null; | public Task Modify(Action<Properties> func) => null; | ||||
/// <inheritdoc /> | |||||
public Task Delete() => null; | |||||
} | } | ||||
} | } |
@@ -18,7 +18,7 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public DiscordClient Discord { get; } | public DiscordClient Discord { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ModelState State { get; } | |||||
public EntityState State { get; } | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ChannelType Type { get; } | public ChannelType Type { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -39,25 +39,21 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Server Server { get; } | public Server Server { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public IEnumerable<PermissionOverwrite> PermissionOverwrites { get; } | |||||
public IEnumerable<PermissionOverwriteEntry> PermissionOverwrites { get; } | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public PermissionOverwrite? GetPermissionOverwrite(User user) => null; | |||||
public OverwritePermissions? GetPermissionOverwrite(User user) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public PermissionOverwrite? GetPermissionOverwrite(Role role) => null; | |||||
public OverwritePermissions? GetPermissionOverwrite(Role role) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<IEnumerable<User>> GetUsers() => null; | public Task<IEnumerable<User>> GetUsers() => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<IEnumerable<Invite>> GetInvites() => null; | public Task<IEnumerable<Invite>> GetInvites() => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task UpdatePermissionOverwrite(User user, ChannelPermissions allow, ChannelPermissions deny) => null; | |||||
public Task UpdatePermissionOverwrite(User user, OverwritePermissions permissions) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task UpdatePermissionOverwrite(User user, TriStateChannelPermissions permissions) => null; | |||||
/// <inheritdoc /> | |||||
public Task UpdatePermissionOverwrite(Role role, ChannelPermissions allow, ChannelPermissions deny) => null; | |||||
/// <inheritdoc /> | |||||
public Task UpdatePermissionOverwrite(Role role, TriStateChannelPermissions permissions) => null; | |||||
public Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions) => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task RemovePermissionOverwrite(User user) => null; | public Task RemovePermissionOverwrite(User user) => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -66,11 +62,11 @@ namespace Discord | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null; | public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null; | ||||
/// <inheritdoc /> | |||||
public Task Delete() => null; | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task Update() => null; | public Task Update() => null; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public Task Modify(Action<Properties> func) => null; | public Task Modify(Action<Properties> func) => null; | ||||
/// <inheritdoc /> | |||||
public Task Delete() => null; | |||||
} | } | ||||
} | } |
@@ -13,10 +13,8 @@ namespace Discord | |||||
/// <summary> Gets the DiscordClient that manages this object. </summary> | /// <summary> Gets the DiscordClient that manages this object. </summary> | ||||
DiscordClient Discord { get; } | DiscordClient Discord { get; } | ||||
/// <summary> Gets the state of this object. </summary> | /// <summary> Gets the state of this object. </summary> | ||||
ModelState State { get; } | |||||
/// <summary> Deletes this object. </summary> | |||||
Task Delete(); | |||||
EntityState State { get; } | |||||
/// <summary> Downloads the latest values and updates this object. </summary> | /// <summary> Downloads the latest values and updates this object. </summary> | ||||
Task Update(); | Task Update(); | ||||
} | } | ||||
@@ -3,7 +3,7 @@ using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
public class Invite : IModel<string> | |||||
public class Invite : IEntity<string> | |||||
{ | { | ||||
public class ServerInfo | public class ServerInfo | ||||
{ | { | ||||
@@ -23,10 +23,11 @@ namespace Discord | |||||
public string AvatarId { get; } | public string AvatarId { get; } | ||||
public string AvatarUrl { get; } | public string AvatarUrl { get; } | ||||
} | } | ||||
public DiscordClient Client { get; } | |||||
string IModel<string>.Id => Code; | |||||
string IEntity<string>.Id => Code; | |||||
public DiscordClient Discord { get; } | |||||
public EntityState State { get; } | |||||
public string Code { get; } | public string Code { get; } | ||||
public string XkcdCode { get; } | public string XkcdCode { get; } | ||||
@@ -40,9 +41,9 @@ namespace Discord | |||||
public DateTime CreatedAt { get; } | public DateTime CreatedAt { get; } | ||||
public string Url { get; } | public string Url { get; } | ||||
public Task Delete() => null; | |||||
public Task Accept() => null; | public Task Accept() => null; | ||||
public Task Save() => null; | |||||
} | |||||
public Task Update() => null; | |||||
public Task Delete() => null; | |||||
} | |||||
} | } |
@@ -38,13 +38,14 @@ namespace Discord | |||||
public int? Width { get; } | public int? Width { get; } | ||||
public int? Height { get; } | public int? Height { get; } | ||||
} | } | ||||
public DiscordClient Client { get; } | |||||
public ulong Id { get; } | public ulong Id { get; } | ||||
public DiscordClient Discord { get; } | |||||
public EntityState State { get; } | |||||
public ITextChannel Channel { get; } | public ITextChannel Channel { get; } | ||||
public User User { get; } | public User User { get; } | ||||
public bool IsTTS { get; } | public bool IsTTS { get; } | ||||
public MessageState State { get; } | |||||
public string RawText { get; } | public string RawText { get; } | ||||
public string Text { get; } | public string Text { get; } | ||||
public DateTime Timestamp { get; } | public DateTime Timestamp { get; } | ||||
@@ -59,10 +60,9 @@ namespace Discord | |||||
public Server Server => null; | public Server Server => null; | ||||
public bool IsAuthor => false; | public bool IsAuthor => false; | ||||
public Task Delete() => null; | |||||
public Task Save() => null; | |||||
public bool IsMentioningMe(bool includeRoles = false) => false; | public bool IsMentioningMe(bool includeRoles = false) => false; | ||||
public Task Update() => null; | |||||
public Task Delete() => null; | |||||
} | } | ||||
} | } |
@@ -6,12 +6,11 @@ | |||||
public static ChannelPermissions TextOnly { get; } | public static ChannelPermissions TextOnly { get; } | ||||
public static ChannelPermissions PrivateOnly { get; } | public static ChannelPermissions PrivateOnly { get; } | ||||
public static ChannelPermissions VoiceOnly { get; } | public static ChannelPermissions VoiceOnly { get; } | ||||
public static ChannelPermissions All(Channel channel) => default(ChannelPermissions); | |||||
public static ChannelPermissions All(ChannelType channelType, bool isPrivate) => default(ChannelPermissions); | |||||
public static ChannelPermissions All(ChannelType channelType) => default(ChannelPermissions); | |||||
public uint RawValue { get; } | public uint RawValue { get; } | ||||
public bool CreateInstantInvit { get; } | |||||
public bool CreateInstantInvite { get; } | |||||
public bool ManagePermission { get; } | public bool ManagePermission { get; } | ||||
public bool ManageChannel { get; } | public bool ManageChannel { get; } | ||||
@@ -44,7 +43,7 @@ | |||||
{ | { | ||||
} | } | ||||
public ChannelPermissions Modify(ChannelPermissions basePerms, bool? createInstantInvite = null, bool? managePermissions = null, | |||||
public ChannelPermissions Modify(bool? createInstantInvite = null, bool? managePermissions = null, | |||||
bool? manageChannel = null, bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null, | bool? manageChannel = null, bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null, | ||||
bool? manageMessages = null, bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, | bool? manageMessages = null, bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, | ||||
bool? mentionEveryone = null, bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null, | bool? mentionEveryone = null, bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null, | ||||
@@ -1,8 +1,8 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
public struct TriStateChannelPermissions | |||||
public struct OverwritePermissions | |||||
{ | { | ||||
public static TriStateChannelPermissions InheritAll { get; } | |||||
public static OverwritePermissions InheritAll { get; } | |||||
public uint AllowValue { get; } | public uint AllowValue { get; } | ||||
public uint DenyValue { get; } | public uint DenyValue { get; } | ||||
@@ -26,7 +26,7 @@ | |||||
public PermValue MoveMembers { get; } | public PermValue MoveMembers { get; } | ||||
public PermValue UseVoiceActivation { get; } | public PermValue UseVoiceActivation { get; } | ||||
public TriStateChannelPermissions(PermValue? createInstantInvite = null, PermValue? managePermissions = null, | |||||
public OverwritePermissions(PermValue? createInstantInvite = null, PermValue? managePermissions = null, | |||||
PermValue? manageChannel = null, PermValue? readMessages = null, PermValue? sendMessages = null, PermValue? sendTTSMessages = null, | PermValue? manageChannel = null, PermValue? readMessages = null, PermValue? sendMessages = null, PermValue? sendTTSMessages = null, | ||||
PermValue? manageMessages = null, PermValue? embedLinks = null, PermValue? attachFiles = null, PermValue? readMessageHistory = null, | PermValue? manageMessages = null, PermValue? embedLinks = null, PermValue? attachFiles = null, PermValue? readMessageHistory = null, | ||||
PermValue? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null, | PermValue? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null, | ||||
@@ -35,16 +35,16 @@ | |||||
{ | { | ||||
} | } | ||||
public TriStateChannelPermissions(uint allow = 0, uint deny = 0) | |||||
public OverwritePermissions(uint allow = 0, uint deny = 0) | |||||
: this() | : this() | ||||
{ | { | ||||
} | } | ||||
public TriStateChannelPermissions Modify(PermValue? createInstantInvite = null, PermValue? managePermissions = null, | |||||
public OverwritePermissions Modify(PermValue? createInstantInvite = null, PermValue? managePermissions = null, | |||||
PermValue? manageChannel = null, PermValue? readMessages = null, PermValue? sendMessages = null, PermValue? sendTTSMessages = null, | PermValue? manageChannel = null, PermValue? readMessages = null, PermValue? sendMessages = null, PermValue? sendTTSMessages = null, | ||||
PermValue? manageMessages = null, PermValue? embedLinks = null, PermValue? attachFiles = null, PermValue? readMessageHistory = null, | PermValue? manageMessages = null, PermValue? embedLinks = null, PermValue? attachFiles = null, PermValue? readMessageHistory = null, | ||||
PermValue? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null, | PermValue? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null, | ||||
PermValue? moveMembers = null, PermValue? useVoiceActivation = null) | PermValue? moveMembers = null, PermValue? useVoiceActivation = null) | ||||
=> default(TriStateChannelPermissions); | |||||
=> default(OverwritePermissions); | |||||
} | } | ||||
} | } |
@@ -1,9 +0,0 @@ | |||||
namespace Discord | |||||
{ | |||||
public struct PermissionOverwrite | |||||
{ | |||||
public PermissionTarget TargetType { get; } | |||||
public ulong TargetId { get; } | |||||
public TriStateChannelPermissions Permissions { get; } | |||||
} | |||||
} |
@@ -44,7 +44,7 @@ | |||||
{ | { | ||||
} | } | ||||
public ServerPermissions Modify(ServerPermissions basePerms, bool? createInstantInvite = null, bool? manageRoles = null, | |||||
public ServerPermissions Modify(bool? createInstantInvite = null, bool? manageRoles = null, | |||||
bool? kickMembers = null, bool? banMembers = null, bool? manageChannel = null, bool? manageServer = null, | bool? kickMembers = null, bool? banMembers = null, bool? manageChannel = null, bool? manageServer = null, | ||||
bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null, bool? manageMessages = null, | bool? readMessages = null, bool? sendMessages = null, bool? sendTTSMessages = null, bool? manageMessages = null, | ||||
bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, bool? mentionEveryone = null, | bool? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, bool? mentionEveryone = null, | ||||
@@ -3,10 +3,11 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
public class Profile : IEntity<ulong> | public class Profile : IEntity<ulong> | ||||
{ | |||||
public DiscordClient Client { get; } | |||||
{ | |||||
public ulong Id { get; } | public ulong Id { get; } | ||||
public DiscordClient Discord { get; } | |||||
public EntityState State { get; } | |||||
public string AvatarId { get; } | public string AvatarId { get; } | ||||
public string AvatarUrl { get; } | public string AvatarUrl { get; } | ||||
public ushort Discriminator { get; } | public ushort Discriminator { get; } | ||||
@@ -16,8 +17,9 @@ namespace Discord | |||||
public string Email { get; } | public string Email { get; } | ||||
public bool? IsVerified { get; } | public bool? IsVerified { get; } | ||||
public string Name { get; set; } | |||||
public string Name { get; set; } | |||||
public Task Save() => null; | |||||
public Task Update() => null; | |||||
public Task Delete() => null; | |||||
} | } | ||||
} | } |
@@ -7,14 +7,5 @@ | |||||
public string Hostname { get; } | public string Hostname { get; } | ||||
public int Port { get; } | public int Port { get; } | ||||
public bool Vip { get; } | public bool Vip { get; } | ||||
internal Region(string id, string name, string hostname, int port, bool vip) | |||||
{ | |||||
Id = id; | |||||
Name = name; | |||||
Hostname = hostname; | |||||
Port = port; | |||||
Vip = vip; | |||||
} | |||||
} | } | ||||
} | } |
@@ -5,9 +5,10 @@ namespace Discord | |||||
{ | { | ||||
public class Role : IEntity<ulong>, IMentionable | public class Role : IEntity<ulong>, IMentionable | ||||
{ | { | ||||
public DiscordClient Client { get; } | |||||
public ulong Id { get; } | public ulong Id { get; } | ||||
public DiscordClient Discord { get; } | |||||
public EntityState State { get; } | |||||
public Server Server { get; } | public Server Server { get; } | ||||
public string Name { get; } | public string Name { get; } | ||||
@@ -21,9 +22,8 @@ namespace Discord | |||||
public IEnumerable<User> Members { get; } | public IEnumerable<User> Members { get; } | ||||
public string Mention { get; } | public string Mention { get; } | ||||
public Task Delete() => null; | |||||
public Task Save() => null; | |||||
public Task Update() => null; | |||||
public Task Delete() => null; | |||||
} | } | ||||
} | } |
@@ -16,6 +16,9 @@ namespace Discord | |||||
} | } | ||||
public ulong Id { get; } | public ulong Id { get; } | ||||
public DiscordClient Discord { get; } | |||||
public EntityState State { get; } | |||||
public User CurrentUser { get; } | public User CurrentUser { get; } | ||||
public string IconId { get; } | public string IconId { get; } | ||||
public string SplashId { get; } | public string SplashId { get; } | ||||
@@ -50,11 +53,8 @@ namespace Discord | |||||
public Task<IEnumerable<User>> DownloadBans() => null; | public Task<IEnumerable<User>> DownloadBans() => null; | ||||
public Task<IEnumerable<Invite>> DownloadInvites() => null; | public Task<IEnumerable<Invite>> DownloadInvites() => null; | ||||
public Task Leave() => null; | |||||
public Task Delete() => null; | |||||
public Task Save() => null; | |||||
public Task<Channel> CreateChannel(string name, ChannelType type) => null; | |||||
public Task<TextChannel> CreateTextChannel(string name) => null; | |||||
public Task<VoiceChannel> CreateVoiceChannel(string name) => null; | |||||
public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null; | public Task<Invite> CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null; | ||||
public Task<Role> CreateRole(string name, ServerPermissions? permissions = null, Color color = null, bool isHoisted = false) => null; | public Task<Role> CreateRole(string name, ServerPermissions? permissions = null, Color color = null, bool isHoisted = false) => null; | ||||
@@ -62,9 +62,10 @@ namespace Discord | |||||
public Task Unban(User user) => null; | public Task Unban(User user) => null; | ||||
public Task Unban(ulong userId) => null; | public Task Unban(ulong userId) => null; | ||||
public Task ReorderChannels(IEnumerable<Channel> channels) => null; | |||||
public Task ReorderRoles(IEnumerable<Role> roles, Role after = null) => null; | |||||
public Task<int> PruneUsers(int days = 30, bool simulate = false) => null; | public Task<int> PruneUsers(int days = 30, bool simulate = false) => null; | ||||
} | |||||
public Task Update() => null; | |||||
public Task Leave() => null; | |||||
public Task Delete() => null; | |||||
} | |||||
} | } |
@@ -5,13 +5,13 @@ using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
public class User : IModel<ulong> | |||||
{ | |||||
public DiscordClient Client { get; } | |||||
public class User : IEntity<ulong> | |||||
{ | |||||
public ulong Id { get; } | public ulong Id { get; } | ||||
public Server Server { get; } | |||||
public DiscordClient Discord { get; } | |||||
public EntityState State { get; } | |||||
public Server Server { get; } | |||||
public string Name { get; } | public string Name { get; } | ||||
public ushort Discriminator { get; } | public ushort Discriminator { get; } | ||||
public string AvatarId { get; } | public string AvatarId { get; } | ||||
@@ -20,7 +20,6 @@ namespace Discord | |||||
public DateTime JoinedAt { get; } | public DateTime JoinedAt { get; } | ||||
public DateTime? LastActivityAt { get; } | public DateTime? LastActivityAt { get; } | ||||
public Channel PrivateChannel => null; | |||||
public string Mention => null; | public string Mention => null; | ||||
public bool IsSelfMuted => false; | public bool IsSelfMuted => false; | ||||
public bool IsSelfDeafened => false; | public bool IsSelfDeafened => false; | ||||
@@ -28,18 +27,14 @@ namespace Discord | |||||
public bool IsServerDeafened => false; | public bool IsServerDeafened => false; | ||||
public bool IsServerSuppressed => false; | public bool IsServerSuppressed => false; | ||||
public DateTime? LastOnlineAt => null; | public DateTime? LastOnlineAt => null; | ||||
public Channel VoiceChannel => null; | |||||
public VoiceChannel VoiceChannel => null; | |||||
public string AvatarUrl => null; | public string AvatarUrl => null; | ||||
public IEnumerable<Role> Roles => null; | |||||
public IEnumerable<Channel> Channels => null; | |||||
public Task Kick() => null; | |||||
public IEnumerable<Role> Roles => null; | |||||
public IEnumerable<IPublicChannel> Channels => null; | |||||
public ServerPermissions ServerPermissions => default(ServerPermissions); | public ServerPermissions ServerPermissions => default(ServerPermissions); | ||||
public ChannelPermissions GetPermissions(Channel channel) => default(ChannelPermissions); | |||||
public Task<Channel> CreatePMChannel() => null; | |||||
public ChannelPermissions GetPermissions(IPublicChannel channel) => default(ChannelPermissions); | |||||
public Task<PrivateChannel> GetPrivateChannel() => null; | |||||
public Task<Message> SendMessage(string text) => null; | public Task<Message> SendMessage(string text) => null; | ||||
public Task<Message> SendFile(string filePath) => null; | public Task<Message> SendFile(string filePath) => null; | ||||
@@ -50,6 +45,7 @@ namespace Discord | |||||
public Task AddRoles(params Role[] roles) => null; | public Task AddRoles(params Role[] roles) => null; | ||||
public Task RemoveRoles(params Role[] roles) => null; | public Task RemoveRoles(params Role[] roles) => null; | ||||
public Task Save() => null; | |||||
public Task Update() => null; | |||||
public Task Kick() => null; | |||||
} | } | ||||
} | } |
@@ -0,0 +1,18 @@ | |||||
namespace Discord | |||||
{ | |||||
public enum EntityState : byte | |||||
{ | |||||
/// <summary> Object is not attached to a cache manager nor receiving live updates. </summary> | |||||
Detached = 0, | |||||
/// <summary> Object is attached to a cache manager and receiving live updates. </summary> | |||||
Attached, | |||||
/// <summary> Object was deleted. </summary> | |||||
Deleted, | |||||
/// <summary> Object is currently waiting to be created. </summary> | |||||
Queued, | |||||
/// <summary> Object's creation was aborted. </summary> | |||||
Aborted, | |||||
/// <summary> Object's creation failed. </summary> | |||||
Failed | |||||
} | |||||
} |
@@ -2,6 +2,7 @@ | |||||
{ | { | ||||
public enum LogSeverity | public enum LogSeverity | ||||
{ | { | ||||
Critical = 0, | |||||
Error = 1, | Error = 1, | ||||
Warning = 2, | Warning = 2, | ||||
Info = 3, | Info = 3, | ||||
@@ -1,18 +0,0 @@ | |||||
namespace Discord | |||||
{ | |||||
public enum ModelState : byte | |||||
{ | |||||
/// <summary> Message did not originate from this session, or was successfully sent. </summary> | |||||
Normal = 0, | |||||
/// <summary> Message is current queued. </summary> | |||||
Queued, | |||||
/// <summary> Message was deleted. </summary> | |||||
Deleted, | |||||
/// <summary> Message was deleted before it was sent. </summary> | |||||
Aborted, | |||||
/// <summary> Message failed to be sent. </summary> | |||||
Failed, | |||||
/// <summary> Message has been removed from cache and will no longer receive updates. </summary> | |||||
Detached | |||||
} | |||||
} |
@@ -1,31 +0,0 @@ | |||||
namespace Discord | |||||
{ | |||||
internal enum PermissionBits | |||||
{ | |||||
//General | |||||
CreateInstantInvite = 0, | |||||
KickMembers = 1, | |||||
BanMembers = 2, | |||||
ManageRolesOrPermissions = 3, | |||||
ManageChannel = 4, | |||||
ManageServer = 5, | |||||
//Text | |||||
ReadMessages = 10, | |||||
SendMessages = 11, | |||||
SendTTSMessages = 12, | |||||
ManageMessages = 13, | |||||
EmbedLinks = 14, | |||||
AttachFiles = 15, | |||||
ReadMessageHistory = 16, | |||||
MentionEveryone = 17, | |||||
//Voice | |||||
Connect = 20, | |||||
Speak = 21, | |||||
MuteMembers = 22, | |||||
DeafenMembers = 23, | |||||
MoveMembers = 24, | |||||
UseVoiceActivation = 25 | |||||
} | |||||
} |
@@ -4,7 +4,6 @@ namespace Discord | |||||
{ | { | ||||
public class ChannelEventArgs : EventArgs | public class ChannelEventArgs : EventArgs | ||||
{ | { | ||||
public Channel Channel => null; | |||||
public Server Server => null; | |||||
public IChannel Channel => null; | |||||
} | } | ||||
} | } |
@@ -6,6 +6,5 @@ namespace Discord | |||||
{ | { | ||||
public IChannel Before => null; | public IChannel Before => null; | ||||
public IChannel After => null; | public IChannel After => null; | ||||
public Server Server => null; | |||||
} | } | ||||
} | } |
@@ -6,7 +6,6 @@ namespace Discord | |||||
{ | { | ||||
public Message Message => null; | public Message Message => null; | ||||
public User User => null; | public User User => null; | ||||
public Channel Channel => null; | |||||
public Server Server => null; | |||||
public ITextChannel Channel => null; | |||||
} | } | ||||
} | } |
@@ -7,7 +7,6 @@ namespace Discord | |||||
public Message Before => null; | public Message Before => null; | ||||
public Message After => null; | public Message After => null; | ||||
public User User => null; | public User User => null; | ||||
public Channel Channel => null; | |||||
public Server Server => null; | |||||
public ITextChannel Channel => null; | |||||
} | } | ||||
} | } |
@@ -4,6 +4,5 @@ namespace Discord | |||||
public class UserEventArgs : EventArgs | public class UserEventArgs : EventArgs | ||||
{ | { | ||||
public User User => null; | public User User => null; | ||||
public Server Server => null; | |||||
} | } | ||||
} | } |
@@ -5,6 +5,5 @@ namespace Discord | |||||
{ | { | ||||
public User Before => null; | public User Before => null; | ||||
public User After => null; | public User After => null; | ||||
public Server Server => null; | |||||
} | } | ||||
} | } |
@@ -7,11 +7,5 @@ namespace Discord.Net.WebSockets | |||||
{ | { | ||||
public string Type { get; } | public string Type { get; } | ||||
public JToken Payload { get; } | public JToken Payload { get; } | ||||
internal WebSocketEventEventArgs(string type, JToken data) | |||||
{ | |||||
Type = type; | |||||
Payload = data; | |||||
} | |||||
} | } | ||||
} | } |