diff --git a/docs/features/management.rst b/docs/features/management.rst
deleted file mode 100644
index accbf5d94..000000000
--- a/docs/features/management.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-|stub| Server Management
-========================
-
-|stub-desc|
\ No newline at end of file
diff --git a/docs/features/server-management.rst b/docs/features/server-management.rst
new file mode 100644
index 000000000..d555875a8
--- /dev/null
+++ b/docs/features/server-management.rst
@@ -0,0 +1,53 @@
+Server Management
+=================
+
+Discord.Net will allow you to manage most settings of a Discord server.
+
+Usage
+-----
+
+You can create Channels, Invites, and Roles on a server using the CreateChannel, CreateInvite, and CreateRole function of a Server, respectively.
+
+You may also edit a server's name, icon, and region.
+
+.. code-block:: c#
+
+ // Create a Channel and retrieve the Channel object
+ var _channel = await _server.CreateChannel("announcements", ChannelType.Text);
+
+ // Create an Invite and retrieve the Invite object
+ var _invite = await _server.CreateInvite(maxAge: null, maxUses: 25, tempMembership: false, withXkcd: false);
+
+ // Create a Role and retrieve the Role object
+ var _role = await _server.CreateRole(name: "Bots", permissions: null, color: Color.DarkMagenta, isHoisted: false);
+
+ // Edit a server
+ var _ioStream = new System.IO.StreamReader("clock-0500-1952.png").BaseStream
+ _server.Edit(name: "19:52 | UTC-05:00", region: "east", icon: _ioStream, iconType: ImageType.Png);
+
+ // Prune Users
+ var _pruneCount = await _server.PruneUsers(30, true);
+
+Invite Parameters
+-----------------
+
+maxAge: The time (in seconds) until the invite expires. Use null for infinite.
+maxUses: The maximum amount of uses the invite has before it expires.
+tempMembership: Whether or not to kick a user when they disconnect.
+withXkcd: Generate the invite with an XKCD 936 style URL
+
+Role Parameters
+---------------
+
+name: The name of the role
+permissions: A set of ServerPermissions for the role to use by default
+color: The color of the role, recommended to use Discord.Color
+isHoisted: Whether a role's users should be displayed separately from other users in the user list.
+
+Edit Parameters
+---------------
+
+name: The server's name
+region: The region the voice server is hosted in
+icon: A System.IO.Stream that will read an image file
+iconType: The type of image being sent (png/jpeg).
diff --git a/docs/features/user-management.rst b/docs/features/user-management.rst
new file mode 100644
index 000000000..972b3ab4b
--- /dev/null
+++ b/docs/features/user-management.rst
@@ -0,0 +1,22 @@
+User Management
+===============
+
+Banning
+-------
+
+To ban a user, invoke the Ban function on a Server object.
+
+.. code-block:: c#
+
+ _server.Ban(_user, 30);
+
+The pruneDays parameter, which defaults to 0, will remove all messages from a user dating back to the specified amount of days.
+
+Kicking
+-------
+
+To kick a user, invoke the Kick function on the User.
+
+.. code-block:: c#
+
+ _user.Kick();
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 1e8ee492e..f9dfd857d 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -18,14 +18,16 @@ You can get Discord.Net from NuGet:
* `Discord.Net`_
* `Discord.Net.Commands`_
* `Discord.Net.Modules`_
+* `Discord.Net.Audio`_
If you have trouble installing from NuGet, try installing dependencies manually.
You can also pull the latest source from `GitHub`_
-.. _Discord.Net: https://www.nuget.org/packages/Discord.Net/0.8.1-beta2
-.. _Discord.Net.Commands: https://www.nuget.org/packages/Discord.Net.Commands/0.8.1-beta2
-.. _Discord.Net.Modules: https://www.nuget.org/packages/Discord.Net.Modules/0.8.1-beta2
+.. _Discord.Net: https://www.nuget.org/packages/Discord.Net
+.. _Discord.Net.Commands: https://www.nuget.org/packages/Discord.Net.Commands
+.. _Discord.Net.Modules: https://www.nuget.org/packages/Discord.Net.Modules
+.. _Discord.Net.Modules: https://www.nuget.org/packages/Discord.Net.Audio
.. _GitHub: https://github.com/RogueException/Discord.Net/
Async
diff --git a/docs/index.rst b/docs/index.rst
index c4469cd46..d2ff662af 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -29,7 +29,8 @@ This Documentation is **currently undergoing a rewrite**. Some pages (marked wit
getting_started
features/logging
- features/management
+ features/server-management
+ features/user-management
features/permissions
features/commands
features/voice
diff --git a/ref/Discord.Net.xproj b/ref/Discord.Net.xproj
new file mode 100644
index 000000000..d3559797d
--- /dev/null
+++ b/ref/Discord.Net.xproj
@@ -0,0 +1,21 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ 5b2afee6-fff6-4ba2-be12-61b283b72ac0
+ Discord
+ ..\..\artifacts\obj\$(MSBuildProjectName)
+ ..\..\artifacts\bin\$(MSBuildProjectName)\
+
+
+ 2.0
+
+
+ True
+
+
+
\ No newline at end of file
diff --git a/ref/DiscordClient.cs b/ref/DiscordClient.cs
new file mode 100644
index 000000000..aa777e04f
--- /dev/null
+++ b/ref/DiscordClient.cs
@@ -0,0 +1,75 @@
+using Discord.Net.Rest;
+using Discord.Net.WebSockets;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ /// Provides a connection to the DiscordApp service.
+ public class DiscordClient : IDisposable
+ {
+ public event EventHandler Log = delegate { };
+
+ public event EventHandler LoggedIn = delegate { };
+ public event EventHandler LoggedOut = delegate { };
+ public event EventHandler Connected = delegate { };
+ public event EventHandler Disconnected = delegate { };
+ public event EventHandler VoiceConnected = delegate { };
+ public event EventHandler VoiceDisconnected = delegate { };
+
+ public event EventHandler ChannelCreated = delegate { };
+ public event EventHandler ChannelUpdated = delegate { };
+ public event EventHandler ChannelDestroyed = delegate { };
+ public event EventHandler MessageAcknowledged = delegate { };
+ public event EventHandler MessageDeleted = delegate { };
+ public event EventHandler MessageReceived = delegate { };
+ public event EventHandler MessageSent = delegate { };
+ public event EventHandler MessageUpdated = delegate { };
+ public event EventHandler ProfileUpdated = delegate { };
+ public event EventHandler RoleCreated = delegate { };
+ public event EventHandler RoleUpdated = delegate { };
+ public event EventHandler RoleDeleted = delegate { };
+ public event EventHandler JoinedServer = delegate { };
+ public event EventHandler LeftServer = delegate { };
+ public event EventHandler ServerAvailable = delegate { };
+ public event EventHandler ServerUpdated = delegate { };
+ public event EventHandler ServerUnavailable = delegate { };
+ public event EventHandler UserBanned = delegate { };
+ public event EventHandler UserIsTyping = delegate { };
+ public event EventHandler UserJoined = delegate { };
+ public event EventHandler UserLeft = delegate { };
+ public event EventHandler UserUpdated = delegate { };
+ public event EventHandler UserUnbanned = delegate { };
+
+ public MessageQueue MessageQueue { get; }
+ public IRestClient RestClient { get; }
+ public GatewaySocket GatewaySocket { get; }
+ public Profile CurrentUser { get; }
+
+ public DiscordClient() { }
+ public DiscordClient(DiscordConfig config) { }
+
+ public Task Login(string token) => null;
+ public Task Logout() => null;
+
+ public Task Connect() => null;
+ public Task Connect(int connectionId, int totalConnections) => null;
+ public Task Disconnect() => null;
+
+ public Task> GetPrivateChannels() => null;
+ public Task GetPrivateChannel(ulong userId) => null;
+ public Task GetInvite(string inviteIdOrXkcd) => null;
+ public Task> GetRegions() => null;
+ public Task GetRegion(string id) => null;
+ public Task> GetServers() => null;
+ public Task GetServer(ulong id) => null;
+
+ public Task CreatePrivateChannel(ulong userId) => null;
+ public Task CreateServer(string name, Region region, ImageType iconType = ImageType.None, Stream icon = null) => null;
+
+ public void Dispose() { }
+ }
+}
\ No newline at end of file
diff --git a/ref/DiscordConfig.cs b/ref/DiscordConfig.cs
new file mode 100644
index 000000000..e6b1a5568
--- /dev/null
+++ b/ref/DiscordConfig.cs
@@ -0,0 +1,65 @@
+using Discord.Net.Rest;
+using Discord.Net.WebSockets;
+using System.Reflection;
+
+namespace Discord
+{
+ public class DiscordConfig
+ {
+ public const int MaxMessageSize = 2000;
+ public const int MaxMessagesPerBatch = 100;
+
+ public const string LibName = "Discord.Net";
+ public static string LibVersion => typeof(DiscordConfig).GetTypeInfo().Assembly?.GetName().Version.ToString(3) ?? "Unknown";
+ public const string LibUrl = "https://github.com/RogueException/Discord.Net";
+
+ public const string ClientAPIUrl = "https://discordapp.com/api/";
+ public const string CDNUrl = "https://cdn.discordapp.com/";
+ public const string InviteUrl = "https://discord.gg/";
+
+ /// Gets or sets name of your application, used in the user agent.
+ public string AppName { get; set; } = null;
+ /// Gets or sets url to your application, used in the user agent.
+ public string AppUrl { get; set; } = null;
+ /// Gets or sets the version of your application, used in the user agent.
+ public string AppVersion { get; set; } = null;
+
+ /// Gets or sets the minimum log level severity that will be sent to the LogMessage event.
+ public LogSeverity LogLevel { get; set; } = LogSeverity.Info;
+
+ /// Gets or sets the time (in milliseconds) to wait for the websocket to connect and initialize.
+ public int ConnectionTimeout { get; set; } = 30000;
+ /// Gets or sets the time (in milliseconds) to wait after an unexpected disconnect before reconnecting.
+ public int ReconnectDelay { get; set; } = 1000;
+ /// Gets or sets the time (in milliseconds) to wait after an reconnect fails before retrying.
+ public int FailedReconnectDelay { get; set; } = 15000;
+
+ //Performance
+
+ /// Gets or sets the number of messages per channel that should be kept in cache. Setting this to zero disables the message cache entirely.
+ public int MessageCacheSize { get; set; } = 100;
+ ///
+ /// Gets or sets whether the permissions cache should be used.
+ /// This makes operations such as User.GetPermissions(Channel), User.ServerPermissions, Channel.GetUser, and Channel.Members much faster while increasing memory usage.
+ ///
+ public bool UsePermissionsCache { get; set; } = true;
+ /// Gets or sets whether the a copy of a model is generated on an update event to allow you to check which properties changed.
+ public bool EnablePreUpdateEvents { get; set; } = true;
+ ///
+ /// Gets or sets the max number of users a server may have for offline users to be included in the READY packet. Max is 250.
+ /// Decreasing this may reduce CPU usage while increasing login time and network usage.
+ ///
+ public int LargeThreshold { get; set; } = 250;
+
+ //Engines
+
+ /// Gets or sets the REST engine to use.. Defaults to DefaultRestClientProvider, which uses .Net's HttpClient class.
+ public IRestClientProvider RestClientProvider { get; set; } = null;
+ ///
+ /// Gets or sets the WebSocket engine to use. Defaults to DefaultWebSocketProvider, which uses .Net's WebSocketClient class.
+ /// WebSockets are only used if DiscordClient.Connect() is called.
+ ///
+ public IWebSocketProvider WebSocketProvider { get; set; } = null;
+ }
+}
+
diff --git a/ref/Entities/Channels/IChannel.cs b/ref/Entities/Channels/IChannel.cs
new file mode 100644
index 000000000..fb82fb30d
--- /dev/null
+++ b/ref/Entities/Channels/IChannel.cs
@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public interface IChannel : IEntity
+ {
+ /// Gets the type flags for this channel.
+ ChannelType Type { get; }
+ /// Gets the name of this channel.
+ string Name { get; }
+
+ /// Gets a user in this channel with the given id.
+ Task GetUser(ulong id);
+ /// Gets a collection of all users in this channel.
+ Task> GetUsers();
+ }
+}
diff --git a/ref/Entities/Channels/IPublicChannel.cs b/ref/Entities/Channels/IPublicChannel.cs
new file mode 100644
index 000000000..bd005a288
--- /dev/null
+++ b/ref/Entities/Channels/IPublicChannel.cs
@@ -0,0 +1,43 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public interface IPublicChannel : IChannel
+ {
+ /// Gets the server this channel is a member of.
+ Server Server { get; }
+ /// Gets a collection of permission overwrites for this channel.
+ IEnumerable PermissionOverwrites { get; }
+ /// Gets the position of this public channel relative to others of the same type.
+ int Position { get; }
+
+ /// Gets a user in this channel with the given id.
+ new Task GetUser(ulong id);
+ /// Gets a collection of all users in this channel.
+ new Task> GetUsers();
+
+ /// Gets the permission overwrite for a specific user, or null if one does not exist.
+ OverwritePermissions? GetPermissionOverwrite(ServerUser user);
+ /// Gets the permission overwrite for a specific role, or null if one does not exist.
+ OverwritePermissions? GetPermissionOverwrite(Role role);
+ /// Downloads a collection of all invites to this server.
+ Task> GetInvites();
+
+ /// Adds or updates the permission overwrite for the given user.
+ Task UpdatePermissionOverwrite(ServerUser user, OverwritePermissions permissions);
+ /// Adds or updates the permission overwrite for the given role.
+ Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions);
+ /// Removes the permission overwrite for the given user, if one exists.
+ Task RemovePermissionOverwrite(ServerUser user);
+ /// Removes the permission overwrite for the given role, if one exists.
+ Task RemovePermissionOverwrite(Role role);
+
+ /// Creates a new invite to this channel.
+ /// Time (in seconds) until the invite expires. Set to null to never expire.
+ /// The max amount of times this invite may be used. Set to null to have unlimited uses.
+ /// If true, a user accepting this invite will be kicked from the server after closing their client.
+ /// If true, creates a human-readable link. Not supported if maxAge is set to null.
+ Task CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false);
+ }
+}
diff --git a/ref/Entities/Channels/ITextChannel.cs b/ref/Entities/Channels/ITextChannel.cs
new file mode 100644
index 000000000..f3701abbf
--- /dev/null
+++ b/ref/Entities/Channels/ITextChannel.cs
@@ -0,0 +1,30 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public interface ITextChannel : IChannel
+ {
+ /// Gets the message in this text channel with the given id, or null if none was found.
+ Task GetMessage(ulong id);
+ /// Gets the last N messages from this text channel.
+ /// The maximum number of messages to retrieve.
+ Task> GetMessages(int limit = DiscordConfig.MaxMessagesPerBatch);
+ /// Gets a collection of messages in this channel.
+ /// The maximum number of messages to retrieve.
+ /// The message to start downloading relative to.
+ /// The direction, from relativeMessageId, to download messages in.
+ Task> GetMessages(int limit = DiscordConfig.MaxMessagesPerBatch, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before);
+
+ /// Sends a message to this text channel.
+ Task SendMessage(string text, bool isTTS = false);
+ /// Sends a file to this text channel, with an optional caption.
+ Task SendFile(string filePath, string text = null, bool isTTS = false);
+ /// Sends a file to this text channel, with an optional caption.
+ Task SendFile(Stream stream, string filename, string text = null, bool isTTS = false);
+
+ /// Broadcasts the "user is typing" message to all users in this channel, lasting 10 seconds.
+ Task SendIsTyping();
+ }
+}
diff --git a/ref/Entities/Channels/PrivateChannel.cs b/ref/Entities/Channels/PrivateChannel.cs
new file mode 100644
index 000000000..ee72c0828
--- /dev/null
+++ b/ref/Entities/Channels/PrivateChannel.cs
@@ -0,0 +1,55 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class PrivateChannel : ITextChannel, IChannel
+ {
+ ///
+ public DiscordClient Discord { get; }
+ ///
+ public EntityState State { get; }
+ ///
+ public ulong Id { get; }
+ ///
+ public PrivateUser Recipient { get; }
+ ///
+ public PrivateUser CurrentUser { get; }
+
+ ///
+ ChannelType IChannel.Type => ChannelType.Private | ChannelType.Text;
+ ///
+ public string Name { get; }
+
+ ///
+ public Task GetUser(ulong id) => null;
+ ///
+ Task IChannel.GetUser(ulong id) => null;
+ ///
+ public Task> GetUsers() => null;
+ ///
+ Task> IChannel.GetUsers() => null;
+ ///
+ public Task GetMessage(ulong id) => null;
+ ///
+ public Task> GetMessages(int limit = 100) => null;
+ ///
+ public Task> GetMessages(int limit = 100, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before) => null;
+
+ ///
+ public Task SendMessage(string text, bool isTTS = false) => null;
+ ///
+ public Task SendFile(string filePath, string text = null, bool isTTS = false) => null;
+ ///
+ public Task SendFile(Stream stream, string filename, string text = null, bool isTTS = false) => null;
+
+ ///
+ public Task SendIsTyping() => null;
+
+ ///
+ public Task Update() => null;
+ ///
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Channels/TextChannel.cs b/ref/Entities/Channels/TextChannel.cs
new file mode 100644
index 000000000..0b1b81c77
--- /dev/null
+++ b/ref/Entities/Channels/TextChannel.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class TextChannel : ITextChannel, IMentionable, IModifiable
+ {
+ public sealed class Properties
+ {
+ public string Name { get; }
+ public string Topic { get; }
+ public int Position { get; }
+ }
+
+ ///
+ public EntityState State { get; }
+ ///
+ public ulong Id { get; }
+ ///
+ public Server Server { get; }
+
+ ///
+ public DiscordClient Discord { get; }
+ ///
+ public ChannelType Type => ChannelType.Public | ChannelType.Text;
+
+ ///
+ public string Name { get; }
+ ///
+ public string Topic { get; }
+ ///
+ public int Position { get; }
+
+ ///
+ public string Mention { get; }
+ ///
+ public IEnumerable PermissionOverwrites { get; }
+
+ ///
+ public OverwritePermissions? GetPermissionOverwrite(ServerUser user) => null;
+ ///
+ public OverwritePermissions? GetPermissionOverwrite(Role role) => null;
+ ///
+ public Task GetUser(ulong id) => null;
+ ///
+ Task IChannel.GetUser(ulong id) => null;
+ ///
+ public Task> GetUsers() => null;
+ ///
+ Task> IChannel.GetUsers() => null;
+ ///
+ public Task GetMessage(ulong id) => null;
+ ///
+ public Task> GetMessages(int limit = 100) => null;
+ ///
+ public Task> GetMessages(int limit = 100, ulong? relativeMessageId = null, Relative relativeDir = Relative.Before) => null;
+ ///
+ public Task> GetInvites() => null;
+
+ ///
+ public Task UpdatePermissionOverwrite(ServerUser user, OverwritePermissions permissions) => null;
+ ///
+ public Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions) => null;
+ ///
+ public Task RemovePermissionOverwrite(ServerUser user) => null;
+ ///
+ public Task RemovePermissionOverwrite(Role role) => null;
+
+ ///
+ public Task SendMessage(string text, bool isTTS = false) => null;
+ ///
+ public Task SendFile(string filePath, string text = null, bool isTTS = false) => null;
+ ///
+ public Task SendFile(Stream stream, string filename, string text = null, bool isTTS = false) => null;
+
+ ///
+ public Task SendIsTyping() => null;
+
+ ///
+ public Task CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null;
+
+ ///
+ public Task Update() => null;
+ ///
+ public Task Modify(Action func) => null;
+ ///
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Channels/VoiceChannel.cs b/ref/Entities/Channels/VoiceChannel.cs
new file mode 100644
index 000000000..6552fadd7
--- /dev/null
+++ b/ref/Entities/Channels/VoiceChannel.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class VoiceChannel : IPublicChannel, IModifiable
+ {
+ public sealed class Properties
+ {
+ public string Name { get; }
+ public int Bitrate { get; set; }
+ public int Position { get; }
+ }
+
+ ///
+ public ulong Id { get; }
+ ///
+ public EntityState State { get; }
+ ///
+ public Server Server { get; }
+
+ ///
+ public DiscordClient Discord { get; }
+ ///
+ ChannelType IChannel.Type => ChannelType.Public | ChannelType.Voice;
+
+ ///
+ public string Name { get; }
+ ///
+ public int Position { get; }
+ ///
+ public int Bitrate { get; }
+
+ ///
+ public string Mention { get; }
+ ///
+ public IEnumerable PermissionOverwrites { get; }
+
+ ///
+ public OverwritePermissions? GetPermissionOverwrite(ServerUser user) => null;
+ ///
+ public OverwritePermissions? GetPermissionOverwrite(Role role) => null;
+ ///
+ public Task GetUser(ulong id) => null;
+ ///
+ Task IChannel.GetUser(ulong id) => null;
+ ///
+ public Task> GetUsers() => null;
+ ///
+ Task> IChannel.GetUsers() => null;
+ ///
+ public Task> GetInvites() => null;
+
+ ///
+ public Task UpdatePermissionOverwrite(ServerUser user, OverwritePermissions permissions) => null;
+ ///
+ public Task UpdatePermissionOverwrite(Role role, OverwritePermissions permissions) => null;
+ ///
+ public Task RemovePermissionOverwrite(ServerUser user) => null;
+ ///
+ public Task RemovePermissionOverwrite(Role role) => null;
+
+ ///
+ public Task CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null;
+
+ ///
+ public Task Update() => null;
+ ///
+ public Task Modify(Action func) => null;
+ ///
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Color.cs b/ref/Entities/Color.cs
new file mode 100644
index 000000000..b3c78debf
--- /dev/null
+++ b/ref/Entities/Color.cs
@@ -0,0 +1,17 @@
+namespace Discord
+{
+ public class Color
+ {
+ public static readonly Color Default = new Color(0);
+
+ public uint RawValue { get; }
+
+ public Color(uint rawValue) { }
+ public Color(byte r, byte g, byte b) { }
+ public Color(float r, float g, float b) { }
+
+ public byte R { get; }
+ public byte G { get; }
+ public byte B { get; }
+ }
+}
diff --git a/ref/Entities/IEntity.cs b/ref/Entities/IEntity.cs
new file mode 100644
index 000000000..ac707a69e
--- /dev/null
+++ b/ref/Entities/IEntity.cs
@@ -0,0 +1,20 @@
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public interface IEntity : IEntity
+ {
+ /// Gets the unique identifier for this object.
+ TId Id { get; }
+ }
+ public interface IEntity
+ {
+ /// Gets the DiscordClient that manages this object.
+ DiscordClient Discord { get; }
+ /// Gets the state of this object.
+ EntityState State { get; }
+
+ /// Downloads the latest values and updates this object.
+ Task Update();
+ }
+}
diff --git a/ref/Entities/IMentionable.cs b/ref/Entities/IMentionable.cs
new file mode 100644
index 000000000..0a4bf439c
--- /dev/null
+++ b/ref/Entities/IMentionable.cs
@@ -0,0 +1,7 @@
+namespace Discord
+{
+ public interface IMentionable
+ {
+ string Mention { get; }
+ }
+}
diff --git a/ref/Entities/IModifiable.cs b/ref/Entities/IModifiable.cs
new file mode 100644
index 000000000..f264c96f2
--- /dev/null
+++ b/ref/Entities/IModifiable.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public interface IModifiable
+ {
+ /// Modifies one or more of the properties of this object.
+ Task Modify(Action func);
+ }
+}
diff --git a/ref/Entities/Invite/BasicInvite.cs b/ref/Entities/Invite/BasicInvite.cs
new file mode 100644
index 000000000..37cd1704d
--- /dev/null
+++ b/ref/Entities/Invite/BasicInvite.cs
@@ -0,0 +1,37 @@
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class BasicInvite : IEntity
+ {
+ public class TargetInfo
+ {
+ public ulong Id { get; }
+ public string Name { get; }
+ }
+ public class InviterInfo
+ {
+ public ulong Id { get; }
+ public string Name { get; }
+ public ushort Discriminator { get; }
+ public string AvatarId { get; }
+ public string AvatarUrl { get; }
+ }
+
+ string IEntity.Id => Code;
+ public DiscordClient Discord { get; }
+ public EntityState State { get; }
+
+ public string Code { get; }
+ public string XkcdCode { get; }
+
+ public TargetInfo Server { get; }
+ public TargetInfo Channel { get; }
+
+ public string Url { get; }
+
+ public Task Accept() => null;
+
+ public virtual Task Update() => null;
+ }
+}
diff --git a/ref/Entities/Invite/Invite.cs b/ref/Entities/Invite/Invite.cs
new file mode 100644
index 000000000..11fead2af
--- /dev/null
+++ b/ref/Entities/Invite/Invite.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class Invite : BasicInvite
+ {
+ public int? MaxAge { get; }
+ public int Uses { get; }
+ public int? MaxUses { get; }
+ public bool IsRevoked { get; }
+ public bool IsTemporary { get; }
+ public DateTime CreatedAt { get; }
+
+ public override Task Update() => null;
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Message.cs b/ref/Entities/Message.cs
new file mode 100644
index 000000000..78c4e41bd
--- /dev/null
+++ b/ref/Entities/Message.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class Message : IEntity
+ {
+ public class Attachment : File
+ {
+ public string Id { get; }
+ public int Size { get; }
+ public string Filename { get; }
+ }
+
+ public class Embed
+ {
+ public string Url { get; }
+ public string Type { get; }
+ public string Title { get; }
+ public string Description { get; }
+ public EmbedLink Author { get; }
+ public EmbedLink Provider { get; }
+ public File Thumbnail { get; }
+ public File Video { get; }
+ }
+
+ public class EmbedLink
+ {
+ public string Url { get; }
+ public string Name { get; }
+ }
+
+ public class File
+ {
+ public string Url { get; }
+ public string ProxyUrl { get; }
+ public int? Width { get; }
+ public int? Height { get; }
+ }
+
+ public ulong Id { get; }
+ public DiscordClient Discord { get; }
+ public EntityState State { get; }
+
+ public ITextChannel Channel { get; }
+ public IUser User { get; }
+ public bool IsTTS { get; }
+ public string RawText { get; }
+ public string Text { get; }
+ public DateTime Timestamp { get; }
+ public DateTime? EditedTimestamp { get; }
+ public Attachment[] Attachments { get; }
+ public Embed[] Embeds { get; }
+
+ public IReadOnlyList MentionedUsers { get; }
+ public IReadOnlyList MentionedChannels { get; }
+ public IReadOnlyList MentionedRoles { get; }
+
+ public Server Server => null;
+ public bool IsAuthor => false;
+
+ public bool IsMentioningMe(bool includeRoles = false) => false;
+
+ public Task Update() => null;
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Permissions/ChannelPermissions.cs b/ref/Entities/Permissions/ChannelPermissions.cs
new file mode 100644
index 000000000..d01f0430e
--- /dev/null
+++ b/ref/Entities/Permissions/ChannelPermissions.cs
@@ -0,0 +1,53 @@
+namespace Discord
+{
+ public struct ChannelPermissions
+ {
+ public static ChannelPermissions None { get; }
+ public static ChannelPermissions TextOnly { get; }
+ public static ChannelPermissions PrivateOnly { get; }
+ public static ChannelPermissions VoiceOnly { get; }
+ public static ChannelPermissions All(ChannelType channelType) => default(ChannelPermissions);
+
+ public uint RawValue { get; }
+
+ public bool CreateInstantInvite { get; }
+ public bool ManagePermission { get; }
+ public bool ManageChannel { get; }
+
+ public bool ReadMessages { get; }
+ public bool SendMessages { get; }
+ public bool SendTTSMessages { get; }
+ public bool ManageMessages { get; }
+ public bool EmbedLinks { get; }
+ public bool AttachFiles { get; }
+ public bool ReadMessageHistory { get; }
+ public bool MentionEveryone { get; }
+
+ public bool Connect { get; }
+ public bool Speak { get; }
+ public bool MuteMembers { get; }
+ public bool DeafenMembers { get; }
+ public bool MoveMembers { get; }
+ public bool UseVoiceActivation { get; }
+
+ public ChannelPermissions(bool? createInstantInvite = null, bool? managePermissions = 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? mentionEveryone = null, bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
+ bool? moveMembers = null, bool? useVoiceActivation = null)
+ : this()
+ {
+ }
+ public ChannelPermissions(uint rawValue)
+ : this()
+ {
+ }
+
+ public ChannelPermissions Modify(bool? createInstantInvite = null, bool? managePermissions = 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? mentionEveryone = null, bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
+ bool? moveMembers = null, bool? useVoiceActivation = null)
+ => default(ChannelPermissions);
+ }
+}
diff --git a/ref/Entities/Permissions/OverwritePermissions.cs b/ref/Entities/Permissions/OverwritePermissions.cs
new file mode 100644
index 000000000..1cda173ec
--- /dev/null
+++ b/ref/Entities/Permissions/OverwritePermissions.cs
@@ -0,0 +1,50 @@
+namespace Discord
+{
+ public struct OverwritePermissions
+ {
+ public static OverwritePermissions InheritAll { get; }
+
+ public uint AllowValue { get; }
+ public uint DenyValue { get; }
+
+ public PermValue CreateInstantInvite { get; }
+ public PermValue ManagePermissions { get; }
+ public PermValue ManageChannel { get; }
+ public PermValue ReadMessages { get; }
+ public PermValue SendMessages { get; }
+ public PermValue SendTTSMessages { get; }
+ public PermValue ManageMessages { get; }
+ public PermValue EmbedLinks { get; }
+ public PermValue AttachFiles { get; }
+ public PermValue ReadMessageHistory { get; }
+ public PermValue MentionEveryone { get; }
+
+ public PermValue Connect { get; }
+ public PermValue Speak { get; }
+ public PermValue MuteMembers { get; }
+ public PermValue DeafenMembers { get; }
+ public PermValue MoveMembers { get; }
+ public PermValue UseVoiceActivation { get; }
+
+ public OverwritePermissions(PermValue? createInstantInvite = null, PermValue? managePermissions = 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? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null,
+ PermValue? moveMembers = null, PermValue? useVoiceActivation = null)
+ : this()
+ {
+ }
+
+ public OverwritePermissions(uint allow = 0, uint deny = 0)
+ : this()
+ {
+ }
+
+ public OverwritePermissions Modify(PermValue? createInstantInvite = null, PermValue? managePermissions = 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? mentionEveryone = null, PermValue? connect = null, PermValue? speak = null, PermValue? muteMembers = null, PermValue? deafenMembers = null,
+ PermValue? moveMembers = null, PermValue? useVoiceActivation = null)
+ => default(OverwritePermissions);
+ }
+}
diff --git a/ref/Entities/Permissions/PermissionOverwriteEntry.cs b/ref/Entities/Permissions/PermissionOverwriteEntry.cs
new file mode 100644
index 000000000..bbc11fba8
--- /dev/null
+++ b/ref/Entities/Permissions/PermissionOverwriteEntry.cs
@@ -0,0 +1,9 @@
+namespace Discord
+{
+ public struct PermissionOverwriteEntry
+ {
+ public PermissionTarget TargetType { get; }
+ public ulong TargetId { get; }
+ public OverwritePermissions Permissions { get; }
+ }
+}
diff --git a/ref/Entities/Permissions/ServerPermissions.cs b/ref/Entities/Permissions/ServerPermissions.cs
new file mode 100644
index 000000000..fe85c07dd
--- /dev/null
+++ b/ref/Entities/Permissions/ServerPermissions.cs
@@ -0,0 +1,55 @@
+namespace Discord
+{
+ public struct ServerPermissions
+ {
+ public static ServerPermissions None { get; }
+ public static ServerPermissions All { get; }
+
+ public uint RawValue { get; }
+
+ public bool CreateInstantInvite { get; }
+ public bool BanMembers { get; }
+ public bool KickMembers { get; }
+ public bool ManageRoles { get; }
+ public bool ManageChannels { get; }
+ public bool ManageServer { get; }
+
+ public bool ReadMessages { get; }
+ public bool SendMessages { get; }
+ public bool SendTTSMessages { get; }
+ public bool ManageMessages { get; }
+ public bool EmbedLinks { get; }
+ public bool AttachFiles { get; }
+ public bool ReadMessageHistory { get; }
+ public bool MentionEveryone { get; }
+
+ public bool Connect { get; }
+ public bool Speak { get; }
+ public bool MuteMembers { get; }
+ public bool DeafenMembers { get; }
+ public bool MoveMembers { get; }
+ public bool UseVoiceActivation { get; }
+
+ public ServerPermissions(bool? createInstantInvite = null, bool? manageRoles = 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? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, bool? mentionEveryone = null,
+ bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
+ bool? moveMembers = null, bool? useVoiceActivation = null)
+ : this()
+ {
+ }
+ public ServerPermissions(uint rawValue)
+ : this()
+ {
+ }
+
+ public ServerPermissions Modify(bool? createInstantInvite = null, bool? manageRoles = 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? embedLinks = null, bool? attachFiles = null, bool? readMessageHistory = null, bool? mentionEveryone = null,
+ bool? connect = null, bool? speak = null, bool? muteMembers = null, bool? deafenMembers = null,
+ bool? moveMembers = null, bool? useVoiceActivation = null)
+ => default(ServerPermissions);
+ }
+}
diff --git a/ref/Entities/Profile.cs b/ref/Entities/Profile.cs
new file mode 100644
index 000000000..aa61e51b2
--- /dev/null
+++ b/ref/Entities/Profile.cs
@@ -0,0 +1,25 @@
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class Profile : IEntity
+ {
+ public ulong Id { get; }
+ public DiscordClient Discord { get; }
+ public EntityState State { get; }
+
+ public string AvatarId { get; }
+ public string AvatarUrl { get; }
+ public ushort Discriminator { get; }
+ public string CurrentGame { get; }
+ public UserStatus Status { get; }
+ public string Mention { get; }
+ public string Email { get; }
+ public bool? IsVerified { get; }
+
+ public string Name { get; set; }
+
+ public Task Update() => null;
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Region.cs b/ref/Entities/Region.cs
new file mode 100644
index 000000000..fbb801eaa
--- /dev/null
+++ b/ref/Entities/Region.cs
@@ -0,0 +1,11 @@
+namespace Discord
+{
+ public class Region
+ {
+ public string Id { get; }
+ public string Name { get; }
+ public string Hostname { get; }
+ public int Port { get; }
+ public bool Vip { get; }
+ }
+}
diff --git a/ref/Entities/Role.cs b/ref/Entities/Role.cs
new file mode 100644
index 000000000..f5155db2e
--- /dev/null
+++ b/ref/Entities/Role.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class Role : IEntity, IMentionable
+ {
+ public ulong Id { get; }
+ public DiscordClient Discord { get; }
+ public EntityState State { get; }
+
+ public Server Server { get; }
+
+ public string Name { get; }
+ public bool IsHoisted { get; }
+ public int Position { get; }
+ public bool IsManaged { get; }
+ public ServerPermissions Permissions { get; }
+ public Color Color { get; }
+
+ public bool IsEveryone { get; }
+ public IEnumerable Members { get; }
+
+ public string Mention { get; }
+
+ public Task Update() => null;
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Server.cs b/ref/Entities/Server.cs
new file mode 100644
index 000000000..a9078cb4b
--- /dev/null
+++ b/ref/Entities/Server.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class Server : IEntity
+ {
+ public class Emoji
+ {
+ public string Id { get; }
+ public string Name { get; }
+ public bool IsManaged { get; }
+ public bool RequireColons { get; }
+ public IEnumerable Roles { get; }
+ }
+
+ public ulong Id { get; }
+ public DiscordClient Discord { get; }
+ public EntityState State { get; }
+
+ public ServerUser CurrentUser { get; }
+ public string IconId { get; }
+ public string SplashId { get; }
+ public string IconUrl { get; }
+ public string SplashUrl { get; }
+ public int ChannelCount { get; }
+ public int UserCount { get; }
+ public int RoleCount { get; }
+ public TextChannel DefaultChannel { get; }
+ public Role EveryoneRole { get; }
+ public IEnumerable Features { get; }
+ public IEnumerable CustomEmojis { get; }
+ public IEnumerable Channels { get; }
+ public IEnumerable TextChannels { get; }
+ public IEnumerable VoiceChannels { get; }
+ public IEnumerable Users { get; }
+ public IEnumerable Roles { get; }
+
+ public string Name { get; set; }
+ public Region Region { get; set; }
+ public int AFKTimeout { get; set; }
+ public DateTime JoinedAt { get; set; }
+ public ServerUser Owner { get; set; }
+ public VoiceChannel AFKChannel { get; set; }
+
+ public Task GetChannel(ulong id) => null;
+ public Task GetChannel(string mention) => null;
+ public Task GetRole(ulong id) => null;
+ public Task GetUser(ulong id) => null;
+ public Task GetUser(string name, ushort discriminator) => null;
+ public Task GetUser(string mention) => null;
+ public Task> GetBans() => null;
+ public Task> GetInvites() => null;
+
+ public Task CreateTextChannel(string name) => null;
+ public Task CreateVoiceChannel(string name) => null;
+ public Task CreateInvite(int? maxAge = 1800, int? maxUses = null, bool tempMembership = false, bool withXkcd = false) => null;
+ public Task CreateRole(string name, ServerPermissions? permissions = null, Color color = null, bool isHoisted = false) => null;
+
+ public Task PruneUsers(int days = 30, bool simulate = false) => null;
+
+ public Task Update() => null;
+ public Task Leave() => null;
+ public Task Delete() => null;
+ }
+}
diff --git a/ref/Entities/Users/IUser.cs b/ref/Entities/Users/IUser.cs
new file mode 100644
index 000000000..02dd2d85b
--- /dev/null
+++ b/ref/Entities/Users/IUser.cs
@@ -0,0 +1,19 @@
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public interface IUser : IEntity, IMentionable
+ {
+ bool IsPrivate { get; }
+
+ string Name { get; }
+ ushort Discriminator { get; }
+ bool IsBot { get; }
+ string AvatarId { get; }
+ string AvatarUrl { get; }
+ string CurrentGame { get; }
+ UserStatus Status { get; }
+
+ Task GetPrivateChannel();
+ }
+}
diff --git a/ref/Entities/Users/PrivateUser.cs b/ref/Entities/Users/PrivateUser.cs
new file mode 100644
index 000000000..a6cc9d6e7
--- /dev/null
+++ b/ref/Entities/Users/PrivateUser.cs
@@ -0,0 +1,43 @@
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ //TODO: Should this be linked directly to the Profile when it represents us, instead of maintaining a cache of values?
+ public class PrivateUser : IUser
+ {
+ ///
+ public EntityState State { get; internal set; }
+ ///
+ public ulong Id { get; }
+ /// Returns the private channel for this user.
+ public PrivateChannel Channel { get; }
+
+ ///
+ bool IUser.IsPrivate => true;
+
+ ///
+ public string Name { get; }
+ ///
+ public ushort Discriminator { get; }
+ ///
+ public bool IsBot { get; }
+ ///
+ public string AvatarId { get; }
+ ///
+ public string CurrentGame { get; }
+ ///
+ public UserStatus Status { get; }
+
+ ///
+ public DiscordClient Discord => Channel.Discord;
+ ///
+ public string AvatarUrl { get; }
+ ///
+ public string Mention { get; }
+
+ ///
+ Task IUser.GetPrivateChannel() => Task.FromResult(Channel);
+
+ public Task Update() => null;
+ }
+}
diff --git a/ref/Entities/Users/ServerUser.cs b/ref/Entities/Users/ServerUser.cs
new file mode 100644
index 000000000..4ff86f67a
--- /dev/null
+++ b/ref/Entities/Users/ServerUser.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Discord
+{
+ public class ServerUser : IUser
+ {
+ ///
+ public EntityState State { get; }
+ ///
+ public ulong Id { get; }
+ /// Returns the private channel for this user.
+ public Server Server { get; }
+
+ ///
+ bool IUser.IsPrivate => false;
+
+ ///
+ public string Name { get; }
+ ///
+ public ushort Discriminator { get; }
+ ///
+ public bool IsBot { get; }
+ ///
+ public string AvatarId { get; }
+ ///
+ public string CurrentGame { get; }
+ ///
+ public UserStatus Status { get; }
+ ///
+ public DateTime JoinedAt { get; }
+ ///
+ public IReadOnlyList Roles { get; }
+
+ /// Returns true if this user has marked themselves as muted.
+ public bool IsSelfMuted { get; }
+ /// Returns true if this user has marked themselves as deafened.
+ public bool IsSelfDeafened { get; }
+ /// Returns true if the server is blocking audio from this user.
+ public bool IsServerMuted { get; }
+ /// Returns true if the server is blocking audio to this user.
+ public bool IsServerDeafened { get; }
+ /// Returns true if the server is temporarily blocking audio to/from this user.
+ public bool IsServerSuppressed { get; }
+ /// Gets this user's current voice channel.
+ public VoiceChannel VoiceChannel { get; }
+
+ ///
+ public DiscordClient Discord { get; }
+ ///
+ public string AvatarUrl { get; }
+ ///
+ public string Mention { get; }
+
+ public ServerPermissions ServerPermissions { get; }
+
+ public ChannelPermissions GetPermissions(IPublicChannel channel) => default(ChannelPermissions);
+ ///
+ public Task GetPrivateChannel() => null;
+ public Task> GetChannels() => null;
+
+ public bool HasRole(Role role) => false;
+
+ public Task AddRoles(params Role[] roles) => null;
+ public Task RemoveRoles(params Role[] roles) => null;
+
+ public Task Update() => null;
+ public Task Kick() => null;
+ public Task Ban(int pruneDays = 0) => null;
+ public Task Unban() => null;
+ }
+}
\ No newline at end of file
diff --git a/ref/Enums/ChannelType.cs b/ref/Enums/ChannelType.cs
new file mode 100644
index 000000000..5ebbf3aa6
--- /dev/null
+++ b/ref/Enums/ChannelType.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace Discord
+{
+ [Flags]
+ public enum ChannelType : byte
+ {
+ Public = 0x01,
+ Private = 0x02,
+ Text = 0x10,
+ Voice = 0x20
+ }
+}
diff --git a/ref/Enums/ConnectionState.cs b/ref/Enums/ConnectionState.cs
new file mode 100644
index 000000000..dfd4ac9eb
--- /dev/null
+++ b/ref/Enums/ConnectionState.cs
@@ -0,0 +1,10 @@
+namespace Discord
+{
+ public enum ConnectionState
+ {
+ Disconnected,
+ Connecting,
+ Connected,
+ Disconnecting
+ }
+}
diff --git a/ref/Enums/EntityState.cs b/ref/Enums/EntityState.cs
new file mode 100644
index 000000000..6ae71e4a3
--- /dev/null
+++ b/ref/Enums/EntityState.cs
@@ -0,0 +1,18 @@
+namespace Discord
+{
+ public enum EntityState : byte
+ {
+ /// Object is not attached to a cache manager nor receiving live updates.
+ Detached = 0,
+ /// Object is attached to a cache manager and receiving live updates.
+ Attached,
+ /// Object was deleted.
+ Deleted,
+ /// Object is currently waiting to be created.
+ Queued,
+ /// Object's creation was aborted.
+ Aborted,
+ /// Object's creation failed.
+ Failed
+ }
+}
diff --git a/ref/Enums/ImageType.cs b/ref/Enums/ImageType.cs
new file mode 100644
index 000000000..738c67a3d
--- /dev/null
+++ b/ref/Enums/ImageType.cs
@@ -0,0 +1,9 @@
+namespace Discord
+{
+ public enum ImageType
+ {
+ None,
+ Jpeg,
+ Png
+ }
+}
diff --git a/ref/Enums/LogSeverity.cs b/ref/Enums/LogSeverity.cs
new file mode 100644
index 000000000..785b0ef46
--- /dev/null
+++ b/ref/Enums/LogSeverity.cs
@@ -0,0 +1,12 @@
+namespace Discord
+{
+ public enum LogSeverity
+ {
+ Critical = 0,
+ Error = 1,
+ Warning = 2,
+ Info = 3,
+ Verbose = 4,
+ Debug = 5
+ }
+}
diff --git a/ref/Enums/PermValue.cs b/ref/Enums/PermValue.cs
new file mode 100644
index 000000000..fe048b016
--- /dev/null
+++ b/ref/Enums/PermValue.cs
@@ -0,0 +1,9 @@
+namespace Discord
+{
+ public enum PermValue
+ {
+ Allow,
+ Deny,
+ Inherit
+ }
+}
diff --git a/ref/Enums/PermissionTarget.cs b/ref/Enums/PermissionTarget.cs
new file mode 100644
index 000000000..96595fb69
--- /dev/null
+++ b/ref/Enums/PermissionTarget.cs
@@ -0,0 +1,8 @@
+namespace Discord
+{
+ public enum PermissionTarget
+ {
+ Role,
+ User
+ }
+}
diff --git a/ref/Enums/Relative.cs b/ref/Enums/Relative.cs
new file mode 100644
index 000000000..aade047d1
--- /dev/null
+++ b/ref/Enums/Relative.cs
@@ -0,0 +1,8 @@
+namespace Discord
+{
+ public enum Relative
+ {
+ Before,
+ After
+ }
+}
diff --git a/ref/Enums/UserStatus.cs b/ref/Enums/UserStatus.cs
new file mode 100644
index 000000000..f2fdfda7c
--- /dev/null
+++ b/ref/Enums/UserStatus.cs
@@ -0,0 +1,9 @@
+namespace Discord
+{
+ public enum UserStatus
+ {
+ Online,
+ Idle,
+ Offline
+ }
+}
diff --git a/ref/Events/ChannelEventArgs.cs b/ref/Events/ChannelEventArgs.cs
new file mode 100644
index 000000000..583075e08
--- /dev/null
+++ b/ref/Events/ChannelEventArgs.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace Discord
+{
+ public class ChannelEventArgs : EventArgs
+ {
+ public IChannel Channel => null;
+ }
+}
diff --git a/ref/Events/ChannelUpdatedEventArgs.cs b/ref/Events/ChannelUpdatedEventArgs.cs
new file mode 100644
index 000000000..bcd809521
--- /dev/null
+++ b/ref/Events/ChannelUpdatedEventArgs.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Discord
+{
+ public class ChannelUpdatedEventArgs : EventArgs
+ {
+ public IChannel Before => null;
+ public IChannel After => null;
+ }
+}
diff --git a/ref/Events/DisconnectedEventArgs.cs b/ref/Events/DisconnectedEventArgs.cs
new file mode 100644
index 000000000..616f3f09d
--- /dev/null
+++ b/ref/Events/DisconnectedEventArgs.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Discord
+{
+ public class DisconnectedEventArgs : EventArgs
+ {
+ public bool WasUnexpected => false;
+ public Exception Exception => null;
+ }
+}
diff --git a/ref/Events/LogMessageEventArgs.cs b/ref/Events/LogMessageEventArgs.cs
new file mode 100644
index 000000000..7dec182d1
--- /dev/null
+++ b/ref/Events/LogMessageEventArgs.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Discord
+{
+ public class LogMessageEventArgs : EventArgs
+ {
+ public LogSeverity Severity => default(LogSeverity);
+ public string Source => null;
+ public string Message => null;
+ public Exception Exception => null;
+ }
+}
diff --git a/ref/Events/MessageEventArgs.cs b/ref/Events/MessageEventArgs.cs
new file mode 100644
index 000000000..f75c7f1a8
--- /dev/null
+++ b/ref/Events/MessageEventArgs.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Discord
+{
+ public class MessageEventArgs : EventArgs
+ {
+ public Message Message => null;
+ public IUser User => null;
+ public ITextChannel Channel => null;
+ }
+}
diff --git a/ref/Events/MessageUpdatedEventArgs.cs b/ref/Events/MessageUpdatedEventArgs.cs
new file mode 100644
index 000000000..d323bf809
--- /dev/null
+++ b/ref/Events/MessageUpdatedEventArgs.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Discord
+{
+ public class MessageUpdatedEventArgs : EventArgs
+ {
+ public Message Before => null;
+ public Message After => null;
+ public IUser User => null;
+ public ITextChannel Channel => null;
+ }
+}
diff --git a/ref/Events/ProfileUpdatedEventArgs.cs b/ref/Events/ProfileUpdatedEventArgs.cs
new file mode 100644
index 000000000..dba55af3b
--- /dev/null
+++ b/ref/Events/ProfileUpdatedEventArgs.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Discord
+{
+ public class ProfileUpdatedEventArgs : EventArgs
+ {
+ public Profile Before => null;
+ public Profile After => null;
+ }
+}
diff --git a/ref/Events/RoleEventArgs.cs b/ref/Events/RoleEventArgs.cs
new file mode 100644
index 000000000..db1d09cbc
--- /dev/null
+++ b/ref/Events/RoleEventArgs.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Discord
+{
+ public class RoleEventArgs : EventArgs
+ {
+ public Role Role => null;
+ public Server Server => null;
+ }
+}
diff --git a/ref/Events/RoleUpdatedEventArgs.cs b/ref/Events/RoleUpdatedEventArgs.cs
new file mode 100644
index 000000000..1fa0f2a81
--- /dev/null
+++ b/ref/Events/RoleUpdatedEventArgs.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Discord
+{
+ public class RoleUpdatedEventArgs : EventArgs
+ {
+ public Role Before => null;
+ public Role After => null;
+ public Server Server => null;
+ }
+}
diff --git a/ref/Events/ServerEventArgs.cs b/ref/Events/ServerEventArgs.cs
new file mode 100644
index 000000000..b06993de9
--- /dev/null
+++ b/ref/Events/ServerEventArgs.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace Discord
+{
+ public class ServerEventArgs : EventArgs
+ {
+ public Server Server => null;
+ }
+}
diff --git a/ref/Events/ServerUpdatedEventArgs.cs b/ref/Events/ServerUpdatedEventArgs.cs
new file mode 100644
index 000000000..1e05f1721
--- /dev/null
+++ b/ref/Events/ServerUpdatedEventArgs.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Discord
+{
+ public class ServerUpdatedEventArgs : EventArgs
+ {
+ public Server Before => null;
+ public Server After => null;
+ }
+}
diff --git a/ref/Events/TypingEventArgs.cs b/ref/Events/TypingEventArgs.cs
new file mode 100644
index 000000000..f45313687
--- /dev/null
+++ b/ref/Events/TypingEventArgs.cs
@@ -0,0 +1,14 @@
+namespace Discord
+{
+ public class TypingEventArgs
+ {
+ public ITextChannel Channel { get; }
+ public IUser User { get; }
+
+ public TypingEventArgs(ITextChannel channel, IUser user)
+ {
+ Channel = channel;
+ User = user;
+ }
+ }
+}
diff --git a/ref/Events/UserEventArgs.cs b/ref/Events/UserEventArgs.cs
new file mode 100644
index 000000000..f1cce29fc
--- /dev/null
+++ b/ref/Events/UserEventArgs.cs
@@ -0,0 +1,8 @@
+using System;
+namespace Discord
+{
+ public class UserEventArgs : EventArgs
+ {
+ public IUser User => null;
+ }
+}
diff --git a/ref/Events/UserUpdatedEventArgs.cs b/ref/Events/UserUpdatedEventArgs.cs
new file mode 100644
index 000000000..c45c60701
--- /dev/null
+++ b/ref/Events/UserUpdatedEventArgs.cs
@@ -0,0 +1,9 @@
+using System;
+namespace Discord
+{
+ public class UserUpdatedEventArgs : EventArgs
+ {
+ public IUser Before => null;
+ public IUser After => null;
+ }
+}
diff --git a/ref/Format.cs b/ref/Format.cs
new file mode 100644
index 000000000..e30931ae9
--- /dev/null
+++ b/ref/Format.cs
@@ -0,0 +1,14 @@
+namespace Discord
+{
+ public static class Format
+ {
+ public static string Escape(string text) => null;
+
+ public static string Bold(string text, bool escape = true) => null;
+ public static string Italics(string text, bool escape = true) => null;
+ public static string Underline(string text, bool escape = true) => null;
+ public static string Strikeout(string text, bool escape = true) => null;
+
+ public static string Code(string text, string language = null) => null;
+ }
+}
diff --git a/ref/ILogger.cs b/ref/ILogger.cs
new file mode 100644
index 000000000..a3123edc9
--- /dev/null
+++ b/ref/ILogger.cs
@@ -0,0 +1,30 @@
+using System;
+
+namespace Discord.Logging
+{
+ public interface ILogger
+ {
+ LogSeverity Level { get; }
+
+ void Log(LogSeverity severity, string message, Exception exception = null);
+ void Error(string message, Exception exception = null);
+ void Error(Exception exception);
+ void Warning(string message, Exception exception = null);
+ void Warning(Exception exception);
+ void Info(string message, Exception exception = null);
+ void Info(Exception exception);
+ void Verbose(string message, Exception exception = null);
+ void Verbose(Exception exception);
+ void Debug(string message, Exception exception = null);
+ void Debug(Exception exception);
+
+#if DOTNET5_4
+ void Log(LogSeverity severity, FormattableString message, Exception exception = null);
+ void Error(FormattableString message, Exception exception = null);
+ void Warning(FormattableString message, Exception exception = null);
+ void Info(FormattableString message, Exception exception = null);
+ void Verbose(FormattableString message, Exception exception = null);
+ void Debug(FormattableString message, Exception exception = null);
+#endif
+ }
+}
diff --git a/ref/MessageQueue.cs b/ref/MessageQueue.cs
new file mode 100644
index 000000000..5f56abd1e
--- /dev/null
+++ b/ref/MessageQueue.cs
@@ -0,0 +1,9 @@
+namespace Discord
+{
+ public class MessageQueue
+ {
+ public int Count { get; }
+
+ public void Clear() { }
+ }
+}
diff --git a/ref/Net/HttpException.cs b/ref/Net/HttpException.cs
new file mode 100644
index 000000000..3704ffb83
--- /dev/null
+++ b/ref/Net/HttpException.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Net;
+
+namespace Discord.Net
+{
+ public class HttpException : Exception
+ {
+ public HttpStatusCode StatusCode { get; }
+
+ public HttpException(HttpStatusCode statusCode)
+ : base($"The server responded with error {(int)statusCode} ({statusCode})")
+ {
+ StatusCode = statusCode;
+ }
+ }
+}
diff --git a/ref/Net/Rest/CompletedRequestEventArgs.cs b/ref/Net/Rest/CompletedRequestEventArgs.cs
new file mode 100644
index 000000000..ed9d1673f
--- /dev/null
+++ b/ref/Net/Rest/CompletedRequestEventArgs.cs
@@ -0,0 +1,17 @@
+namespace Discord.Net.Rest
+{
+ public class CompletedRequestEventArgs : RequestEventArgs
+ {
+ public object Response { get; set; }
+ public string ResponseJson { get; set; }
+ public double Milliseconds { get; set; }
+
+ public CompletedRequestEventArgs(IRestRequest request, object response, string responseJson, double milliseconds)
+ : base(request)
+ {
+ Response = response;
+ ResponseJson = responseJson;
+ Milliseconds = milliseconds;
+ }
+ }
+}
diff --git a/ref/Net/Rest/IRestClient.cs b/ref/Net/Rest/IRestClient.cs
new file mode 100644
index 000000000..83c0405c7
--- /dev/null
+++ b/ref/Net/Rest/IRestClient.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Discord.Net.Rest
+{
+ public interface IRestClient
+ {
+ event EventHandler SendingRequest;
+ event EventHandler SentRequest;
+
+ CancellationToken CancelToken { get; }
+ string Token { get; }
+
+ Task Send(IRestRequest request)
+ where ResponseT : class;
+ Task Send(IRestRequest request);
+
+ Task Send(IRestFileRequest request)
+ where ResponseT : class;
+ Task Send(IRestFileRequest request);
+ }
+}
diff --git a/ref/Net/Rest/IRestClientProvider.cs b/ref/Net/Rest/IRestClientProvider.cs
new file mode 100644
index 000000000..cb22a7474
--- /dev/null
+++ b/ref/Net/Rest/IRestClientProvider.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using System.Threading;
+
+namespace Discord.Net.Rest
+{
+ public interface IRestClientProvider
+ {
+ IRestClient Create(string baseUrl, CancellationToken cancelToken);
+ }
+}
diff --git a/ref/Net/Rest/IRestRequest.cs b/ref/Net/Rest/IRestRequest.cs
new file mode 100644
index 000000000..9d46e645f
--- /dev/null
+++ b/ref/Net/Rest/IRestRequest.cs
@@ -0,0 +1,25 @@
+using System.IO;
+
+namespace Discord.Net.Rest
+{
+ public interface IRestRequest
+ {
+ string Method { get; }
+ string Endpoint { get; }
+ object Payload { get; }
+ }
+ public interface IRestRequest : IRestRequest
+ where ResponseT : class
+ {
+ }
+
+ public interface IRestFileRequest : IRestRequest
+ {
+ string Filename { get; }
+ Stream Stream { get; }
+ }
+ public interface IRestFileRequest : IRestFileRequest, IRestRequest
+ where ResponseT : class
+ {
+ }
+}
diff --git a/ref/Net/Rest/RequestEventArgs.cs b/ref/Net/Rest/RequestEventArgs.cs
new file mode 100644
index 000000000..cac734fc6
--- /dev/null
+++ b/ref/Net/Rest/RequestEventArgs.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Discord.Net.Rest
+{
+ public class RequestEventArgs : EventArgs
+ {
+ public IRestRequest Request { get; set; }
+ public bool Cancel { get; set; }
+
+ public RequestEventArgs(IRestRequest request) { }
+ }
+}
diff --git a/ref/Net/TimeoutException.cs b/ref/Net/TimeoutException.cs
new file mode 100644
index 000000000..d1a644049
--- /dev/null
+++ b/ref/Net/TimeoutException.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace Discord.Net
+{
+ public class TimeoutException : OperationCanceledException
+ {
+ public TimeoutException() { }
+ }
+}
diff --git a/ref/Net/WebSocketException.cs b/ref/Net/WebSocketException.cs
new file mode 100644
index 000000000..df6377e13
--- /dev/null
+++ b/ref/Net/WebSocketException.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Discord.Net
+{
+ public class WebSocketException : Exception
+ {
+ public int Code { get; }
+ public string Reason { get; }
+
+ public WebSocketException(int code, string reason) { }
+ }
+}
diff --git a/ref/Net/WebSockets/BinaryMessageEventArgs.cs b/ref/Net/WebSockets/BinaryMessageEventArgs.cs
new file mode 100644
index 000000000..3fd4425fa
--- /dev/null
+++ b/ref/Net/WebSockets/BinaryMessageEventArgs.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Discord.Net.WebSockets
+{
+ public class BinaryMessageEventArgs : EventArgs
+ {
+ public byte[] Data { get; }
+
+ public BinaryMessageEventArgs(byte[] data) { }
+ }
+}
diff --git a/ref/Net/WebSockets/GatewaySocket.cs b/ref/Net/WebSockets/GatewaySocket.cs
new file mode 100644
index 000000000..e8f2ddd3d
--- /dev/null
+++ b/ref/Net/WebSockets/GatewaySocket.cs
@@ -0,0 +1,28 @@
+using Discord.Net.Rest;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Discord.Net.WebSockets
+{
+ public class GatewaySocket
+ {
+ public string SessionId { get; }
+
+ public event EventHandler ReceivedDispatch = delegate { };
+
+ public Task Connect(IRestClient rest, CancellationToken parentCancelToken) => null;
+ public Task Disconnect() => null;
+
+ public void SendIdentify(string token) { }
+
+ public void SendResume() { }
+ public void SendHeartbeat() { }
+ public void SendUpdateStatus(long? idleSince, string gameName) { }
+ public void SendUpdateVoice(ulong? serverId, ulong? channelId, bool isSelfMuted, bool isSelfDeafened) { }
+ public void SendRequestMembers(IEnumerable serverId, string query, int limit) { }
+
+ public void WaitForConnection(CancellationToken cancelToken) { }
+ }
+}
diff --git a/ref/Net/WebSockets/IWebSocket.cs b/ref/Net/WebSockets/IWebSocket.cs
new file mode 100644
index 000000000..06a274305
--- /dev/null
+++ b/ref/Net/WebSockets/IWebSocket.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Threading;
+
+namespace Discord.Net.WebSockets
+{
+ public interface IWebSocket
+ {
+ CancellationToken CancelToken { get; }
+ ConnectionState State { get; }
+ string Host { get; set; }
+
+ event EventHandler Connected;
+ event EventHandler Disconnected;
+ }
+}
diff --git a/ref/Net/WebSockets/IWebSocketEngine.cs b/ref/Net/WebSockets/IWebSocketEngine.cs
new file mode 100644
index 000000000..68f31f12b
--- /dev/null
+++ b/ref/Net/WebSockets/IWebSocketEngine.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Discord.Net.WebSockets
+{
+ public interface IWebSocketEngine
+ {
+ event EventHandler BinaryMessage;
+ event EventHandler TextMessage;
+
+ Task Connect(string host, CancellationToken cancelToken);
+ Task Disconnect();
+ void QueueMessage(string message);
+ IEnumerable GetTasks(CancellationToken cancelToken);
+ }
+}
diff --git a/ref/Net/WebSockets/IWebSocketProvider.cs b/ref/Net/WebSockets/IWebSocketProvider.cs
new file mode 100644
index 000000000..20f7559be
--- /dev/null
+++ b/ref/Net/WebSockets/IWebSocketProvider.cs
@@ -0,0 +1,9 @@
+using System.Threading;
+
+namespace Discord.Net.WebSockets
+{
+ public interface IWebSocketProvider
+ {
+ IWebSocket Create(CancellationToken cancelToken);
+ }
+}
diff --git a/ref/Net/WebSockets/TextMessageEventArgs.cs b/ref/Net/WebSockets/TextMessageEventArgs.cs
new file mode 100644
index 000000000..e4e186044
--- /dev/null
+++ b/ref/Net/WebSockets/TextMessageEventArgs.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Discord.Net.WebSockets
+{
+ public class TextMessageEventArgs : EventArgs
+ {
+ public string Message { get; }
+
+ public TextMessageEventArgs(string msg) { Message = msg; }
+ }
+}
diff --git a/ref/Net/WebSockets/WebSocketEventEventArgs.cs b/ref/Net/WebSockets/WebSocketEventEventArgs.cs
new file mode 100644
index 000000000..676c0ba6e
--- /dev/null
+++ b/ref/Net/WebSockets/WebSocketEventEventArgs.cs
@@ -0,0 +1,11 @@
+using Newtonsoft.Json.Linq;
+using System;
+
+namespace Discord.Net.WebSockets
+{
+ public class WebSocketEventEventArgs : EventArgs
+ {
+ public string Type { get; }
+ public JToken Payload { get; }
+ }
+}
diff --git a/ref/project.json b/ref/project.json
new file mode 100644
index 000000000..565bc2e86
--- /dev/null
+++ b/ref/project.json
@@ -0,0 +1,81 @@
+{
+ "version": "0.9.0-rc3-3",
+ "description": "An unofficial .Net API wrapper for the Discord client.",
+ "authors": [
+ "RogueException"
+ ],
+ "tags": [
+ "discord",
+ "discordapp"
+ ],
+ "projectUrl": "https://github.com/RogueException/Discord.Net",
+ "licenseUrl": "http://opensource.org/licenses/MIT",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/RogueException/Discord.Net"
+ },
+ "compile": [ "**/*.cs", "../Discord.Net.Shared/*.cs" ],
+
+ "compilationOptions": {
+ "allowUnsafe": true,
+ "warningsAsErrors": true
+ },
+
+ "configurations": {
+ "TestResponses": {
+ "compilationOptions": {
+ "define": [
+ "DEBUG",
+ "TRACE",
+ "TEST_RESPONSES"
+ ]
+ }
+ }
+ },
+
+ "dependencies": {
+ "Newtonsoft.Json": "8.0.1",
+ "Nito.AsyncEx": "3.0.1"
+ },
+
+ "frameworks": {
+ "dotnet5.4": {
+ "dependencies": {
+ "System.Collections": "4.0.11-beta-23516",
+ "System.Collections.Concurrent": "4.0.11-beta-23516",
+ "System.Dynamic.Runtime": "4.0.11-beta-23516",
+ "System.IO.FileSystem": "4.0.1-beta-23516",
+ "System.IO.Compression": "4.1.0-beta-23516",
+ "System.Linq": "4.0.1-beta-23516",
+ "System.Net.Http": "4.0.1-beta-23516",
+ "System.Net.NameResolution": "4.0.0-beta-23516",
+ "System.Net.Sockets": "4.1.0-beta-23409",
+ "System.Net.Requests": "4.0.11-beta-23516",
+ "System.Net.WebSockets.Client": "4.0.0-beta-23516",
+ "System.Reflection": "4.1.0-beta-23516",
+ "System.Reflection.Emit.Lightweight": "4.0.1-beta-23516",
+ "System.Runtime.InteropServices": "4.0.21-beta-23516",
+ "System.Runtime.Serialization.Primitives": "4.1.0-beta-23516",
+ "System.Security.Cryptography.Algorithms": "4.0.0-beta-23516",
+ "System.Text.RegularExpressions": "4.0.11-beta-23516",
+ "System.Threading": "4.0.11-beta-23516"
+ }
+ },
+ "net45": {
+ "frameworkAssemblies": {
+ "System.Runtime": {
+ "type": "build",
+ "version": ""
+ },
+ "System.Threading.Tasks": {
+ "type": "build",
+ "version": ""
+ }
+ },
+ "dependencies": {
+ "WebSocket4Net": "0.14.1",
+ "RestSharp": "105.2.3"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Discord.Net.Audio.Net45/Discord.Net.Audio.csproj b/src/Discord.Net.Audio.Net45/Discord.Net.Audio.csproj
deleted file mode 100644
index f7326b4a9..000000000
--- a/src/Discord.Net.Audio.Net45/Discord.Net.Audio.csproj
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {7BFEF748-B934-4621-9B11-6302E3A9F6B3}
- Library
- Properties
- Discord.Audio
- Discord.Net.Audio
- 512
- v4.5
- False
-
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;NET45
- prompt
- 4
- 6
- true
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE;NET45
- prompt
- 4
- true
- 6
- true
-
-
-
-
-
-
- AudioClient.cs
-
-
- AudioExtensions.cs
-
-
- AudioMode.cs
-
-
- AudioService.cs
-
-
- AudioServiceConfig.cs
-
-
- IAudioClient.cs
-
-
- InternalFrameEventArgs.cs
-
-
- InternalIsSpeakingEventArgs.cs
-
-
- Net\VoiceSocket.cs
-
-
- Opus\OpusConverter.cs
-
-
- Opus\OpusDecoder.cs
-
-
- Opus\OpusEncoder.cs
-
-
- Sodium\SecretBox.cs
-
-
- UserIsTalkingEventArgs.cs
-
-
- VirtualClient.cs
-
-
- VoiceBuffer.cs
-
-
- VoiceDisconnectedEventArgs.cs
-
-
-
-
-
- {8d71a857-879a-4a10-859e-5ff824ed6688}
- Discord.Net
-
-
-
-
- libsodium.dll
- Always
-
-
- opus.dll
- Always
-
-
-
-
-
- project.json
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Discord.Net.Audio.Net45/Properties/AssemblyInfo.cs b/src/Discord.Net.Audio.Net45/Properties/AssemblyInfo.cs
deleted file mode 100644
index c2c8aa3a7..000000000
--- a/src/Discord.Net.Audio.Net45/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Discord.Net.Audio")]
-[assembly: AssemblyDescription("A Discord.Net extension adding voice support.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("RogueException")]
-[assembly: AssemblyProduct("Discord.Net.Modules")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-[assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")]
-
-[assembly: AssemblyVersion("0.9.0.0")]
-[assembly: AssemblyFileVersion("0.9.0.0")]
-
diff --git a/src/Discord.Net.Audio.Net45/project.json b/src/Discord.Net.Audio.Net45/project.json
deleted file mode 100644
index a9a422249..000000000
--- a/src/Discord.Net.Audio.Net45/project.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "dependencies": {
- "Newtonsoft.Json": "8.0.1",
- "Nito.AsyncEx": "3.0.1"
- },
- "frameworks": {
- "net45": { }
- },
- "runtimes": {
- "win": { },
- "win-x86": { },
- "win-x64": { }
- }
-}
\ No newline at end of file
diff --git a/src/Discord.Net.Audio/AudioClient.cs b/src/Discord.Net.Audio/AudioClient.cs
index 46474f6a4..00aacea12 100644
--- a/src/Discord.Net.Audio/AudioClient.cs
+++ b/src/Discord.Net.Audio/AudioClient.cs
@@ -7,7 +7,6 @@ using Newtonsoft.Json;
using Nito.AsyncEx;
using System;
using System.Diagnostics;
-using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -15,35 +14,6 @@ namespace Discord.Audio
{
internal class AudioClient : IAudioClient
{
- private class OutStream : Stream
- {
- public override bool CanRead => false;
- public override bool CanSeek => false;
- public override bool CanWrite => true;
-
- private readonly AudioClient _client;
-
- internal OutStream(AudioClient client)
- {
- _client = client;
- }
-
- public override long Length { get { throw new InvalidOperationException(); } }
- public override long Position
- {
- get { throw new InvalidOperationException(); }
- set { throw new InvalidOperationException(); }
- }
- public override void Flush() { throw new InvalidOperationException(); }
- public override long Seek(long offset, SeekOrigin origin) { throw new InvalidOperationException(); }
- public override void SetLength(long value) { throw new InvalidOperationException(); }
- public override int Read(byte[] buffer, int offset, int count) { throw new InvalidOperationException(); }
- public override void Write(byte[] buffer, int offset, int count)
- {
- _client.Send(buffer, offset, count);
- }
- }
-
private readonly DiscordConfig _config;
private readonly AsyncLock _connectionLock;
private readonly TaskManager _taskManager;
@@ -58,20 +28,18 @@ namespace Discord.Audio
public GatewaySocket GatewaySocket { get; }
public VoiceSocket VoiceSocket { get; }
public JsonSerializer Serializer { get; }
- public Stream OutputStream { get; }
public CancellationToken CancelToken { get; private set; }
public string SessionId => GatewaySocket.SessionId;
public ConnectionState State => VoiceSocket.State;
public Server Server => VoiceSocket.Server;
- public Channel Channel => VoiceSocket.Channel;
+ public VoiceChannel Channel => VoiceSocket.Channel;
public AudioClient(DiscordClient client, Server server, int id)
{
Id = id;
- _config = client.Config;
- Service = client.Services.Get();
+ Service = client.GetService();
Config = Service.Config;
Serializer = client.Serializer;
_gatewayState = (int)ConnectionState.Disconnected;
@@ -87,6 +55,25 @@ namespace Discord.Audio
//Networking
if (Config.EnableMultiserver)
{
+ //TODO: We can remove this hack when official API launches
+ var baseConfig = client.Config;
+ var builder = new DiscordConfigBuilder
+ {
+ AppName = baseConfig.AppName,
+ AppUrl = baseConfig.AppUrl,
+ AppVersion = baseConfig.AppVersion,
+ CacheToken = baseConfig.CacheDir != null,
+ ConnectionTimeout = baseConfig.ConnectionTimeout,
+ EnablePreUpdateEvents = false,
+ FailedReconnectDelay = baseConfig.FailedReconnectDelay,
+ LargeThreshold = 1,
+ LogLevel = baseConfig.LogLevel,
+ MessageCacheSize = 0,
+ ReconnectDelay = baseConfig.ReconnectDelay,
+ UsePermissionsCache = false
+ };
+ _config = builder.Build();
+
ClientAPI = new JsonRestClient(_config, DiscordConfig.ClientAPIUrl, client.Log.CreateLogger($"ClientAPI #{id}"));
GatewaySocket = new GatewaySocket(_config, client.Serializer, client.Log.CreateLogger($"Gateway #{id}"));
GatewaySocket.Connected += (s, e) =>
@@ -96,11 +83,13 @@ namespace Discord.Audio
};
}
else
+ {
+ _config = client.Config;
GatewaySocket = client.GatewaySocket;
+ }
GatewaySocket.ReceivedDispatch += (s, e) => OnReceivedEvent(e);
VoiceSocket = new VoiceSocket(_config, Config, client.Serializer, client.Log.CreateLogger($"Voice #{id}"));
VoiceSocket.Server = server;
- OutputStream = new OutStream(this);
}
public async Task Connect()
@@ -195,7 +184,7 @@ namespace Discord.Audio
_gatewayState = (int)ConnectionState.Disconnected;
}
- public async Task Join(Channel channel)
+ public async Task Join(VoiceChannel channel)
{
if (channel == null) throw new ArgumentNullException(nameof(channel));
if (channel.Type != ChannelType.Voice)
@@ -209,7 +198,7 @@ namespace Discord.Audio
SendVoiceUpdate(channel.Server.Id, channel.Id);
using (await _connectionLock.LockAsync().ConfigureAwait(false))
- await Task.Run(() => VoiceSocket.WaitForConnection(CancelToken));
+ await Task.Run(() => VoiceSocket.WaitForConnection(CancelToken)).ConfigureAwait(false);
}
private async void OnReceivedEvent(WebSocketEventEventArgs e)
@@ -227,7 +216,7 @@ namespace Discord.Audio
await Disconnect().ConfigureAwait(false);
else
{
- var channel = Service.Client.GetChannel(data.ChannelId.Value);
+ var channel = Service.Client.GetChannel(data.ChannelId.Value) as VoiceChannel;
if (channel != null)
VoiceSocket.Channel = channel;
else
diff --git a/src/Discord.Net.Audio/AudioExtensions.cs b/src/Discord.Net.Audio/AudioExtensions.cs
index 50f508ff5..7def445a6 100644
--- a/src/Discord.Net.Audio/AudioExtensions.cs
+++ b/src/Discord.Net.Audio/AudioExtensions.cs
@@ -7,20 +7,20 @@ namespace Discord.Audio
{
public static DiscordClient UsingAudio(this DiscordClient client, AudioServiceConfig config = null)
{
- client.Services.Add(new AudioService(config));
+ client.AddService(new AudioService(config));
return client;
}
public static DiscordClient UsingAudio(this DiscordClient client, Action configFunc = null)
{
var builder = new AudioServiceConfigBuilder();
configFunc(builder);
- client.Services.Add(new AudioService(builder));
+ client.AddService(new AudioService(builder));
return client;
}
- public static Task JoinAudio(this Channel channel) => channel.Client.Services.Get().Join(channel);
- public static Task LeaveAudio(this Channel channel) => channel.Client.Services.Get().Leave(channel);
- public static Task LeaveAudio(this Server server) => server.Client.Services.Get().Leave(server);
- public static IAudioClient GetAudioClient(Server server) => server.Client.Services.Get().GetClient(server);
+ public static Task JoinAudio(this VoiceChannel channel) => channel.Client.GetService().Join(channel);
+ public static Task LeaveAudio(this VoiceChannel channel) => channel.Client.GetService().Leave(channel);
+ public static Task LeaveAudio(this Server server) => server.Client.GetService().Leave(server);
+ public static IAudioClient GetAudioClient(this Server server) => server.Client.GetService().GetClient(server);
}
}
diff --git a/src/Discord.Net.Audio/AudioService.cs b/src/Discord.Net.Audio/AudioService.cs
index 3de3531ae..e44a4a1ce 100644
--- a/src/Discord.Net.Audio/AudioService.cs
+++ b/src/Discord.Net.Audio/AudioService.cs
@@ -113,7 +113,7 @@ namespace Discord.Audio
}
}
- public async Task Join(Channel channel)
+ public async Task Join(VoiceChannel channel)
{
if (channel == null) throw new ArgumentNullException(nameof(channel));
@@ -163,8 +163,8 @@ namespace Discord.Audio
}
public Task Leave(Server server) => Leave(server, null);
- public Task Leave(Channel channel) => Leave(channel.Server, channel);
- private async Task Leave(Server server, Channel channel)
+ public Task Leave(VoiceChannel channel) => Leave(channel.Server, channel);
+ private async Task Leave(Server server, VoiceChannel channel)
{
if (server == null) throw new ArgumentNullException(nameof(server));
diff --git a/src/Discord.Net.Audio/IAudioClient.cs b/src/Discord.Net.Audio/IAudioClient.cs
index 71c8783d5..a986fad7d 100644
--- a/src/Discord.Net.Audio/IAudioClient.cs
+++ b/src/Discord.Net.Audio/IAudioClient.cs
@@ -15,11 +15,9 @@ namespace Discord.Audio
/// Gets the current state of this client.
ConnectionState State { get; }
/// Gets the channel this client is currently a member of.
- Channel Channel { get; }
+ VoiceChannel Channel { get; }
/// Gets the server this client is bound to.
Server Server { get; }
- /// Gets a stream object that wraps the Send() function.
- Stream OutputStream { get; }
/// Gets a cancellation token that triggers when the client is manually disconnected.
CancellationToken CancelToken { get; }
@@ -31,7 +29,7 @@ namespace Discord.Audio
VoiceSocket VoiceSocket { get; }
/// Moves the client to another channel on the same server.
- Task Join(Channel channel);
+ Task Join(VoiceChannel channel);
/// Disconnects from the Discord server, canceling any pending requests.
Task Disconnect();
diff --git a/src/Discord.Net.Audio/Net/VoiceSocket.cs b/src/Discord.Net.Audio/Net/VoiceSocket.cs
index adb583f1d..9ee5c60e0 100644
--- a/src/Discord.Net.Audio/Net/VoiceSocket.cs
+++ b/src/Discord.Net.Audio/Net/VoiceSocket.cs
@@ -46,7 +46,7 @@ namespace Discord.Net.WebSockets
public string Token { get; internal set; }
public Server Server { get; internal set; }
- public Channel Channel { get; internal set; }
+ public VoiceChannel Channel { get; internal set; }
public int Ping => _ping;
internal VoiceBuffer OutputBuffer => _sendBuffer;
@@ -371,7 +371,7 @@ namespace Discord.Net.WebSockets
break;
}
}
- await _udp.SendAsync(pingPacket, pingPacket.Length);
+ await _udp.SendAsync(pingPacket, pingPacket.Length).ConfigureAwait(false);
nextPingTicks = currentTicks + 5 * ticksPerSeconds;
}
}
@@ -395,7 +395,7 @@ namespace Discord.Net.WebSockets
//Closes the UDP socket when _disconnectToken is triggered, since UDPClient doesn't allow passing a canceltoken
private async Task WatcherAsync()
{
- await CancelToken.Wait();
+ await CancelToken.Wait().ConfigureAwait(false);
_udp.Close();
}
#endif
diff --git a/src/Discord.Net.Audio/VirtualClient.cs b/src/Discord.Net.Audio/VirtualClient.cs
index 12d285a0d..9c8100e47 100644
--- a/src/Discord.Net.Audio/VirtualClient.cs
+++ b/src/Discord.Net.Audio/VirtualClient.cs
@@ -16,8 +16,7 @@ namespace Discord.Audio
public string SessionId => _client.Server == Server ? _client.SessionId : null;
public ConnectionState State => _client.Server == Server ? _client.State : ConnectionState.Disconnected;
- public Channel Channel => _client.Server == Server ? _client.Channel : null;
- public Stream OutputStream => _client.Server == Server ? _client.OutputStream : null;
+ public VoiceChannel Channel => _client.Server == Server ? _client.Channel : null;
public CancellationToken CancelToken => _client.Server == Server ? _client.CancelToken : CancellationToken.None;
public RestClient ClientAPI => _client.Server == Server ? _client.ClientAPI : null;
@@ -31,7 +30,7 @@ namespace Discord.Audio
}
public Task Disconnect() => _client.Service.Leave(Server);
- public Task Join(Channel channel) => _client.Join(channel);
+ public Task Join(VoiceChannel channel) => _client.Join(channel);
public void Send(byte[] data, int offset, int count) => _client.Send(data, offset, count);
public void Clear() => _client.Clear();
diff --git a/src/Discord.Net.Audio/project.json b/src/Discord.Net.Audio/project.json
index 664767ba7..c41a619c7 100644
--- a/src/Discord.Net.Audio/project.json
+++ b/src/Discord.Net.Audio/project.json
@@ -1,5 +1,5 @@
{
- "version": "0.9.0-rc3",
+ "version": "1.0.0-alpha1",
"description": "A Discord.Net extension adding voice support.",
"authors": [ "RogueException" ],
"tags": [ "discord", "discordapp" ],
@@ -18,7 +18,7 @@
},
"dependencies": {
- "Discord.Net": "0.9.0-rc3-3"
+ "Discord.Net": "1.0.0-alpha1"
},
"frameworks": {
"net45": { },
diff --git a/src/Discord.Net.Commands.Net45/Discord.Net.Commands.csproj b/src/Discord.Net.Commands.Net45/Discord.Net.Commands.csproj
deleted file mode 100644
index e3ce3c79a..000000000
--- a/src/Discord.Net.Commands.Net45/Discord.Net.Commands.csproj
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {1B5603B4-6F8F-4289-B945-7BAAE523D740}
- Library
- Properties
- Discord.Commands
- Discord.Net.Commands
- 512
- v4.5
- False
-
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;NET45
- prompt
- 4
- 6
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE;NET45
- prompt
- 4
- true
- 6
-
-
-
-
-
-
- Command.cs
-
-
- CommandBuilder.cs
-
-
- CommandErrorEventArgs.cs
-
-
- CommandEventArgs.cs
-
-
- CommandExtensions.cs
-
-
- CommandMap.cs
-
-
- CommandParameter.cs
-
-
- CommandParser.cs
-
-
- CommandService.cs
-
-
- CommandServiceConfig.cs
-
-
- HelpMode.cs
-
-
- Permissions\GenericPermissionChecker.cs
-
-
- Permissions\IPermissionChecker.cs
-
-
- Permissions\Levels\PermissionLevelChecker.cs
-
-
- Permissions\Levels\PermissionLevelExtensions.cs
-
-
- Permissions\Levels\PermissionLevelService.cs
-
-
- Permissions\Users\BlacklistChecker.cs
-
-
- Permissions\Users\BlacklistExtensions.cs
-
-
- Permissions\Users\BlacklistService.cs
-
-
- Permissions\Users\UserlistService.cs
-
-
- Permissions\Users\WhitelistChecker.cs
-
-
- Permissions\Users\WhitelistExtensions.cs
-
-
- Permissions\Users\WhitelistService.cs
-
-
- Permissions\Visibility\PrivateChecker.cs
-
-
- Permissions\Visibility\PrivateExtensions.cs
-
-
- Permissions\Visibility\PublicChecker.cs
-
-
- Permissions\Visibility\PublicExtensions.cs
-
-
-
-
-
- {8d71a857-879a-4a10-859e-5ff824ed6688}
- Discord.Net
-
-
-
-
-
-
-
- project.json
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Discord.Net.Commands.Net45/Properties/AssemblyInfo.cs b/src/Discord.Net.Commands.Net45/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1959b2cf3..000000000
--- a/src/Discord.Net.Commands.Net45/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Discord.Net.Commands")]
-[assembly: AssemblyDescription("A Discord.Net extension adding basic command support.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("RogueException")]
-[assembly: AssemblyProduct("Discord.Net.Commands")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-[assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")]
-
-[assembly: AssemblyVersion("0.9.0.0")]
-[assembly: AssemblyFileVersion("0.9.0.0")]
-
diff --git a/src/Discord.Net.Commands.Net45/project.json b/src/Discord.Net.Commands.Net45/project.json
deleted file mode 100644
index 62e5e6154..000000000
--- a/src/Discord.Net.Commands.Net45/project.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "frameworks": {
- "net45": { }
- },
- "runtimes": {
- "win": { },
- "win-x86": { },
- "win-x64": { }
- }
-}
\ No newline at end of file
diff --git a/src/Discord.Net.Commands/Command.cs b/src/Discord.Net.Commands/Command.cs
index a8addc1b1..ccd62798b 100644
--- a/src/Discord.Net.Commands/Command.cs
+++ b/src/Discord.Net.Commands/Command.cs
@@ -52,7 +52,7 @@ namespace Discord.Commands
_checks = checks;
}
- internal bool CanRun(User user, Channel channel, out string error)
+ internal bool CanRun(User user, ITextChannel channel, out string error)
{
for (int i = 0; i < _checks.Length; i++)
{
diff --git a/src/Discord.Net.Commands/CommandBuilder.cs b/src/Discord.Net.Commands/CommandBuilder.cs
index 129dc24ab..6b945841c 100644
--- a/src/Discord.Net.Commands/CommandBuilder.cs
+++ b/src/Discord.Net.Commands/CommandBuilder.cs
@@ -79,7 +79,7 @@ namespace Discord.Commands
_checks.Add(check);
return this;
}
- public CommandBuilder AddCheck(Func checkFunc, string errorMsg = null)
+ public CommandBuilder AddCheck(Func checkFunc, string errorMsg = null)
{
_checks.Add(new GenericPermissionChecker(checkFunc, errorMsg));
return this;
@@ -145,7 +145,7 @@ namespace Discord.Commands
{
_checks.Add(checker);
}
- public void AddCheck(Func checkFunc, string errorMsg = null)
+ public void AddCheck(Func checkFunc, string errorMsg = null)
{
_checks.Add(new GenericPermissionChecker(checkFunc, errorMsg));
}
diff --git a/src/Discord.Net.Commands/CommandEventArgs.cs b/src/Discord.Net.Commands/CommandEventArgs.cs
index 818f5fa23..70793f5e1 100644
--- a/src/Discord.Net.Commands/CommandEventArgs.cs
+++ b/src/Discord.Net.Commands/CommandEventArgs.cs
@@ -10,8 +10,7 @@ namespace Discord.Commands
public Command Command { get; }
public User User => Message.User;
- public Channel Channel => Message.Channel;
- public Server Server => Message.Channel.Server;
+ public ITextChannel Channel => Message.Channel;
public CommandEventArgs(Message message, Command command, string[] args)
{
diff --git a/src/Discord.Net.Commands/CommandExtensions.cs b/src/Discord.Net.Commands/CommandExtensions.cs
index 557f5ac5a..c57cf099f 100644
--- a/src/Discord.Net.Commands/CommandExtensions.cs
+++ b/src/Discord.Net.Commands/CommandExtensions.cs
@@ -6,14 +6,14 @@ namespace Discord.Commands
{
public static DiscordClient UsingCommands(this DiscordClient client, CommandServiceConfig config = null)
{
- client.Services.Add(new CommandService(config));
+ client.AddService(new CommandService(config));
return client;
}
public static DiscordClient UsingCommands(this DiscordClient client, Action configFunc = null)
{
var builder = new CommandServiceConfigBuilder();
configFunc(builder);
- client.Services.Add(new CommandService(builder));
+ client.AddService(new CommandService(builder));
return client;
}
}
diff --git a/src/Discord.Net.Commands/CommandMap.cs b/src/Discord.Net.Commands/CommandMap.cs
index 98decd833..ad280b335 100644
--- a/src/Discord.Net.Commands/CommandMap.cs
+++ b/src/Discord.Net.Commands/CommandMap.cs
@@ -116,7 +116,7 @@ namespace Discord.Commands
}
}
- public bool CanRun(User user, Channel channel, out string error)
+ public bool CanRun(User user, ITextChannel channel, out string error)
{
error = null;
if (_commands.Count > 0)
diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs
index 5969b9691..ea530d27b 100644
--- a/src/Discord.Net.Commands/CommandService.cs
+++ b/src/Discord.Net.Commands/CommandService.cs
@@ -63,7 +63,7 @@ namespace Discord.Commands
.Description("Returns information about commands.")
.Do(async e =>
{
- Channel replyChannel = Config.HelpMode == HelpMode.Public ? e.Channel : await e.User.CreatePMChannel().ConfigureAwait(false);
+ ITextChannel replyChannel = Config.HelpMode == HelpMode.Public ? e.Channel : await e.User.CreatePMChannel().ConfigureAwait(false);
if (e.Args.Length > 0) //Show command help
{
var map = _map.GetItem(string.Join(" ", e.Args));
@@ -97,10 +97,15 @@ namespace Discord.Commands
//Check for mention
if (cmdMsg == null && Config.AllowMentionPrefix)
{
- if (msg.StartsWith(client.CurrentUser.Mention))
- cmdMsg = msg.Substring(client.CurrentUser.Mention.Length + 1);
- else if (msg.StartsWith($"@{client.CurrentUser.Name}"))
- cmdMsg = msg.Substring(client.CurrentUser.Name.Length + 1);
+ string mention = client.CurrentUser.Mention;
+ if (msg.StartsWith(mention) && msg.Length > mention.Length)
+ cmdMsg = msg.Substring(mention.Length + 1);
+ else
+ {
+ mention = $"@{client.CurrentUser.Name}";
+ if (msg.StartsWith(mention) && msg.Length > mention.Length)
+ cmdMsg = msg.Substring(mention.Length + 1);
+ }
}
//Check using custom activator
@@ -170,7 +175,7 @@ namespace Discord.Commands
};
}
- public Task ShowGeneralHelp(User user, Channel channel, Channel replyChannel = null)
+ public Task ShowGeneralHelp(User user, ITextChannel channel, ITextChannel replyChannel = null)
{
StringBuilder output = new StringBuilder();
bool isFirstCategory = true;
@@ -214,32 +219,12 @@ namespace Discord.Commands
if (output.Length == 0)
output.Append("There are no commands you have permission to run.");
else
- {
- output.Append("\n\n");
-
- //TODO: Should prefix be stated in the help message or not?
- /*StringBuilder builder = new StringBuilder();
- if (Config.PrefixChar != null)
- {
- builder.Append('`');
- builder.Append(Config.PrefixChar.Value);
- builder.Append('`');
- }
- if (Config.AllowMentionPrefix)
- {
- if (builder.Length > 0)
- builder.Append(" or ");
- builder.Append(Client.CurrentUser.Mention);
- }
- if (builder.Length > 0)
- output.AppendLine($"Start your message with {builder.ToString()} to run a command.");*/
- output.AppendLine($"Run `help ` for more information.");
- }
+ output.AppendLine("\n\nRun `help ` for more information.");
return (replyChannel ?? channel).SendMessage(output.ToString());
}
- private Task ShowCommandHelp(CommandMap map, User user, Channel channel, Channel replyChannel = null)
+ private Task ShowCommandHelp(CommandMap map, User user, ITextChannel channel, ITextChannel replyChannel = null)
{
StringBuilder output = new StringBuilder();
@@ -250,9 +235,7 @@ namespace Discord.Commands
{
foreach (var cmd in cmds)
{
- if (!cmd.CanRun(user, channel, out error)) { }
- //output.AppendLine(error ?? DefaultPermissionError);
- else
+ if (cmd.CanRun(user, channel, out error))
{
if (isFirstCmd)
isFirstCmd = false;
@@ -294,7 +277,7 @@ namespace Discord.Commands
return (replyChannel ?? channel).SendMessage(output.ToString());
}
- public Task ShowCommandHelp(Command command, User user, Channel channel, Channel replyChannel = null)
+ public Task ShowCommandHelp(Command command, User user, ITextChannel channel, ITextChannel replyChannel = null)
{
StringBuilder output = new StringBuilder();
string error;
@@ -304,7 +287,7 @@ namespace Discord.Commands
ShowCommandHelpInternal(command, user, channel, output);
return (replyChannel ?? channel).SendMessage(output.ToString());
}
- private void ShowCommandHelpInternal(Command command, User user, Channel channel, StringBuilder output)
+ private void ShowCommandHelpInternal(Command command, User user, ITextChannel channel, StringBuilder output)
{
output.Append('`');
output.Append(command.Text);
diff --git a/src/Discord.Net.Commands/Permissions/GenericPermissionChecker.cs b/src/Discord.Net.Commands/GenericPermissionChecker.cs
similarity index 54%
rename from src/Discord.Net.Commands/Permissions/GenericPermissionChecker.cs
rename to src/Discord.Net.Commands/GenericPermissionChecker.cs
index 05e95ac64..10d665811 100644
--- a/src/Discord.Net.Commands/Permissions/GenericPermissionChecker.cs
+++ b/src/Discord.Net.Commands/GenericPermissionChecker.cs
@@ -4,16 +4,16 @@ namespace Discord.Commands.Permissions
{
internal class GenericPermissionChecker : IPermissionChecker
{
- private readonly Func _checkFunc;
+ private readonly Func _checkFunc;
private readonly string _error;
- public GenericPermissionChecker(Func checkFunc, string error = null)
+ public GenericPermissionChecker(Func checkFunc, string error = null)
{
_checkFunc = checkFunc;
_error = error;
}
- public bool CanRun(Command command, User user, Channel channel, out string error)
+ public bool CanRun(Command command, User user, ITextChannel channel, out string error)
{
error = _error;
return _checkFunc(command, user, channel);
diff --git a/src/Discord.Net.Commands/Permissions/IPermissionChecker.cs b/src/Discord.Net.Commands/IPermissionChecker.cs
similarity index 54%
rename from src/Discord.Net.Commands/Permissions/IPermissionChecker.cs
rename to src/Discord.Net.Commands/IPermissionChecker.cs
index f400c3420..0f317ffef 100644
--- a/src/Discord.Net.Commands/Permissions/IPermissionChecker.cs
+++ b/src/Discord.Net.Commands/IPermissionChecker.cs
@@ -2,6 +2,6 @@
{
public interface IPermissionChecker
{
- bool CanRun(Command command, User user, Channel channel, out string error);
+ bool CanRun(Command command, User user, ITextChannel channel, out string error);
}
}
diff --git a/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelChecker.cs b/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelChecker.cs
deleted file mode 100644
index 0ebe5c890..000000000
--- a/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelChecker.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace Discord.Commands.Permissions.Levels
-{
- public class PermissionLevelChecker : IPermissionChecker
- {
- private readonly PermissionLevelService _service;
- private readonly int _minPermissions;
-
- public PermissionLevelService Service => _service;
- public int MinPermissions => _minPermissions;
-
- internal PermissionLevelChecker(DiscordClient client, int minPermissions)
- {
- _service = client.Services.Get(true);
- _minPermissions = minPermissions;
- }
-
- public bool CanRun(Command command, User user, Channel channel, out string error)
- {
- error = null; //Use default error text.
- int permissions = _service.GetPermissionLevel(user, channel);
- return permissions >= _minPermissions;
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelExtensions.cs b/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelExtensions.cs
deleted file mode 100644
index 79cae8857..000000000
--- a/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelExtensions.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-
-namespace Discord.Commands.Permissions.Levels
-{
- public static class PermissionLevelExtensions
- {
- public static DiscordClient UsingPermissionLevels(this DiscordClient client, Func permissionResolver)
- {
- client.Services.Add(new PermissionLevelService(permissionResolver));
- return client;
- }
-
- public static CommandBuilder MinPermissions(this CommandBuilder builder, int minPermissions)
- {
- builder.AddCheck(new PermissionLevelChecker(builder.Service.Client, minPermissions));
- return builder;
- }
- public static CommandGroupBuilder MinPermissions(this CommandGroupBuilder builder, int minPermissions)
- {
- builder.AddCheck(new PermissionLevelChecker(builder.Service.Client, minPermissions));
- return builder;
- }
- public static CommandService MinPermissions(this CommandService service, int minPermissions)
- {
- service.Root.AddCheck(new PermissionLevelChecker(service.Client, minPermissions));
- return service;
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelService.cs b/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelService.cs
deleted file mode 100644
index 6bab13b97..000000000
--- a/src/Discord.Net.Commands/Permissions/Levels/PermissionLevelService.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-
-namespace Discord.Commands.Permissions.Levels
-{
- public class PermissionLevelService : IService
- {
- private readonly Func _getPermissionsFunc;
-
- private DiscordClient _client;
- public DiscordClient Client => _client;
-
- public PermissionLevelService(Func getPermissionsFunc)
- {
- _getPermissionsFunc = getPermissionsFunc;
- }
-
- public void Install(DiscordClient client)
- {
- _client = client;
- }
- public int GetPermissionLevel(User user, Channel channel) => _getPermissionsFunc(user, channel);
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Userlist/BlacklistChecker.cs b/src/Discord.Net.Commands/Permissions/Userlist/BlacklistChecker.cs
deleted file mode 100644
index 0c0b5500b..000000000
--- a/src/Discord.Net.Commands/Permissions/Userlist/BlacklistChecker.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace Discord.Commands.Permissions.Userlist
-{
- public class BlacklistChecker : IPermissionChecker
- {
- private readonly BlacklistService _service;
-
- internal BlacklistChecker(DiscordClient client)
- {
- _service = client.Services.Get(true);
- }
-
- public bool CanRun(Command command, User user, Channel channel, out string error)
- {
- error = null; //Use default error text.
- return _service.CanRun(user);
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Userlist/BlacklistExtensions.cs b/src/Discord.Net.Commands/Permissions/Userlist/BlacklistExtensions.cs
deleted file mode 100644
index 21de4076d..000000000
--- a/src/Discord.Net.Commands/Permissions/Userlist/BlacklistExtensions.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Collections.Generic;
-
-namespace Discord.Commands.Permissions.Userlist
-{
- public static class BlacklistExtensions
- {
- public static DiscordClient UsingGlobalBlacklist(this DiscordClient client, params ulong[] initialUserIds)
- {
- client.Services.Add(new BlacklistService(initialUserIds));
- return client;
- }
-
- public static CommandBuilder UseGlobalBlacklist(this CommandBuilder builder)
- {
- builder.AddCheck(new BlacklistChecker(builder.Service.Client));
- return builder;
- }
- public static CommandGroupBuilder UseGlobalBlacklist(this CommandGroupBuilder builder)
- {
- builder.AddCheck(new BlacklistChecker(builder.Service.Client));
- return builder;
- }
- public static CommandService UseGlobalBlacklist(this CommandService service)
- {
- service.Root.AddCheck(new BlacklistChecker(service.Client));
- return service;
- }
-
- public static IEnumerable GetBlacklistedUserIds(this DiscordClient client)
- => client.Services.Get().UserIds;
- public static void BlacklistUser(this DiscordClient client, User user)
- {
- client.Services.Get().Add(user.Id);
- }
- public static void BlacklistUser(this DiscordClient client, ulong userId)
- {
- client.Services.Get().Add(userId);
- }
- public static void UnBlacklistUser(this DiscordClient client, User user)
- {
- client.Services.Get().Remove(user.Id);
- }
- public static void UnBlacklistUser(this DiscordClient client, ulong userId)
- {
- client.Services.Get().Remove(userId);
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Userlist/BlacklistService.cs b/src/Discord.Net.Commands/Permissions/Userlist/BlacklistService.cs
deleted file mode 100644
index ced4c3fdc..000000000
--- a/src/Discord.Net.Commands/Permissions/Userlist/BlacklistService.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Discord.Commands.Permissions.Userlist
-{
- public class BlacklistService : UserlistService
- {
- public BlacklistService(params ulong[] initialList)
- : base(initialList)
- {
- }
-
- public bool CanRun(User user)
- => !_userList.ContainsKey(user.Id);
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Userlist/UserlistService.cs b/src/Discord.Net.Commands/Permissions/Userlist/UserlistService.cs
deleted file mode 100644
index da8264312..000000000
--- a/src/Discord.Net.Commands/Permissions/Userlist/UserlistService.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Discord.Commands.Permissions.Userlist
-{
- public class UserlistService : IService
- {
- protected readonly ConcurrentDictionary _userList;
- private DiscordClient _client;
-
- public DiscordClient Client => _client;
- public IEnumerable UserIds => _userList.Select(x => x.Key);
-
- public UserlistService(params ulong[] initialUserIds)
- {
- _userList = new ConcurrentDictionary();
- for (int i = 0; i < initialUserIds.Length; i++)
- _userList.TryAdd(initialUserIds[i], true);
- }
-
- public void Add(User user)
- {
- if (user == null) throw new ArgumentNullException(nameof(user));
-
- _userList[user.Id] = true;
- }
- public void Add(ulong userId)
- {
- _userList[userId] = true;
- }
-
- public bool Remove(User user)
- {
- if (user == null) throw new ArgumentNullException(nameof(user));
-
- bool ignored;
- return _userList.TryRemove(user.Id, out ignored);
- }
- public bool Remove(ulong userId)
- {
- bool ignored;
- return _userList.TryRemove(userId, out ignored);
- }
-
- void IService.Install(DiscordClient client)
- {
- _client = client;
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Userlist/WhitelistChecker.cs b/src/Discord.Net.Commands/Permissions/Userlist/WhitelistChecker.cs
deleted file mode 100644
index 783455e3a..000000000
--- a/src/Discord.Net.Commands/Permissions/Userlist/WhitelistChecker.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace Discord.Commands.Permissions.Userlist
-{
- public class WhitelistChecker : IPermissionChecker
- {
- private readonly WhitelistService _service;
-
- internal WhitelistChecker(DiscordClient client)
- {
- _service = client.Services.Get(true);
- }
-
- public bool CanRun(Command command, User user, Channel channel, out string error)
- {
- error = null; //Use default error text.
- return _service.CanRun(user);
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Userlist/WhitelistExtensions.cs b/src/Discord.Net.Commands/Permissions/Userlist/WhitelistExtensions.cs
deleted file mode 100644
index eaa136075..000000000
--- a/src/Discord.Net.Commands/Permissions/Userlist/WhitelistExtensions.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Collections.Generic;
-
-namespace Discord.Commands.Permissions.Userlist
-{
- public static class WhitelistExtensions
- {
- public static DiscordClient UsingGlobalWhitelist(this DiscordClient client, params ulong[] initialUserIds)
- {
- client.Services.Add(new WhitelistService(initialUserIds));
- return client;
- }
-
- public static CommandBuilder UseGlobalWhitelist(this CommandBuilder builder)
- {
- builder.AddCheck(new WhitelistChecker(builder.Service.Client));
- return builder;
- }
- public static CommandGroupBuilder UseGlobalWhitelist(this CommandGroupBuilder builder)
- {
- builder.AddCheck(new WhitelistChecker(builder.Service.Client));
- return builder;
- }
- public static CommandService UseGlobalWhitelist(this CommandService service)
- {
- service.Root.AddCheck(new BlacklistChecker(service.Client));
- return service;
- }
-
- public static IEnumerable GetWhitelistedUserIds(this DiscordClient client)
- => client.Services.Get().UserIds;
- public static void WhitelistUser(this DiscordClient client, User user)
- {
- client.Services.Get().Add(user.Id);
- }
- public static void WhitelistUser(this DiscordClient client, ulong userId)
- {
- client.Services.Get().Add(userId);
- }
- public static void UnWhitelistUser(this DiscordClient client, User user)
- {
- client.Services.Get().Remove(user.Id);
- }
- public static void RemoveFromWhitelist(this DiscordClient client, ulong userId)
- {
- client.Services.Get().Remove(userId);
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Userlist/WhitelistService.cs b/src/Discord.Net.Commands/Permissions/Userlist/WhitelistService.cs
deleted file mode 100644
index ae25d3fd1..000000000
--- a/src/Discord.Net.Commands/Permissions/Userlist/WhitelistService.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Discord.Commands.Permissions.Userlist
-{
- public class WhitelistService : UserlistService
- {
- public WhitelistService(params ulong[] initialList)
- : base(initialList)
- {
- }
-
- public bool CanRun(User user)
- => _userList.ContainsKey(user.Id);
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Visibility/PrivateChecker.cs b/src/Discord.Net.Commands/Permissions/Visibility/PrivateChecker.cs
deleted file mode 100644
index dd336042d..000000000
--- a/src/Discord.Net.Commands/Permissions/Visibility/PrivateChecker.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace Discord.Commands.Permissions.Visibility
-{
- public class PrivateChecker : IPermissionChecker
- {
- internal PrivateChecker() { }
-
- public bool CanRun(Command command, User user, Channel channel, out string error)
- {
- if (user.Server != null)
- {
- error = "This command may only be run in a private chat.";
- return false;
- }
- else
- {
- error = null;
- return true;
- }
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Visibility/PrivateExtensions.cs b/src/Discord.Net.Commands/Permissions/Visibility/PrivateExtensions.cs
deleted file mode 100644
index cb3579983..000000000
--- a/src/Discord.Net.Commands/Permissions/Visibility/PrivateExtensions.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace Discord.Commands.Permissions.Visibility
-{
- public static class PrivateExtensions
- {
- public static CommandBuilder PrivateOnly(this CommandBuilder builder)
- {
- builder.AddCheck(new PrivateChecker());
- return builder;
- }
- public static CommandGroupBuilder PrivateOnly(this CommandGroupBuilder builder)
- {
- builder.AddCheck(new PrivateChecker());
- return builder;
- }
- public static CommandService PrivateOnly(this CommandService service)
- {
- service.Root.AddCheck(new PrivateChecker());
- return service;
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Visibility/PublicChecker.cs b/src/Discord.Net.Commands/Permissions/Visibility/PublicChecker.cs
deleted file mode 100644
index 9e70b647b..000000000
--- a/src/Discord.Net.Commands/Permissions/Visibility/PublicChecker.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace Discord.Commands.Permissions.Visibility
-{
- public class PublicChecker : IPermissionChecker
- {
- internal PublicChecker() { }
-
- public bool CanRun(Command command, User user, Channel channel, out string error)
- {
- if (user.Server == null)
- {
- error = "This command can't be run in a private chat.";
- return false;
- }
- else
- {
- error = null;
- return true;
- }
- }
- }
-}
diff --git a/src/Discord.Net.Commands/Permissions/Visibility/PublicExtensions.cs b/src/Discord.Net.Commands/Permissions/Visibility/PublicExtensions.cs
deleted file mode 100644
index 8cd78a4fe..000000000
--- a/src/Discord.Net.Commands/Permissions/Visibility/PublicExtensions.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace Discord.Commands.Permissions.Visibility
-{
- public static class PublicExtensions
- {
- public static CommandBuilder PublicOnly(this CommandBuilder builder)
- {
- builder.AddCheck(new PublicChecker());
- return builder;
- }
- public static CommandGroupBuilder PublicOnly(this CommandGroupBuilder builder)
- {
- builder.AddCheck(new PublicChecker());
- return builder;
- }
- public static CommandService PublicOnly(this CommandService service)
- {
- service.Root.AddCheck(new PublicChecker());
- return service;
- }
- }
-}
diff --git a/src/Discord.Net.Commands/project.json b/src/Discord.Net.Commands/project.json
index f93bb3d77..124a29dfe 100644
--- a/src/Discord.Net.Commands/project.json
+++ b/src/Discord.Net.Commands/project.json
@@ -1,5 +1,5 @@
{
- "version": "0.9.0-rc3",
+ "version": "1.0.0-alpha1",
"description": "A Discord.Net extension adding basic command support.",
"authors": [ "RogueException" ],
"tags": [ "discord", "discordapp" ],
@@ -16,7 +16,7 @@
},
"dependencies": {
- "Discord.Net": "0.9.0-rc3-3"
+ "Discord.Net": "1.0.0-alpha1"
},
"frameworks": {
"net45": { },
diff --git a/src/Discord.Net.Modules.Net45/Discord.Net.Modules.csproj b/src/Discord.Net.Modules.Net45/Discord.Net.Modules.csproj
deleted file mode 100644
index cab137c25..000000000
--- a/src/Discord.Net.Modules.Net45/Discord.Net.Modules.csproj
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {3091164F-66AE-4543-A63D-167C1116241D}
- Library
- Properties
- Discord.Modules
- Discord.Net.Modules
- 512
- v4.5
- False
-
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;NET45
- prompt
- 4
- 6
- true
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE;NET45
- prompt
- 4
- true
- 6
- true
-
-
-
-
-
-
- IModule.cs
-
-
- ModuleChecker.cs
-
-
- ModuleExtensions.cs
-
-
- ModuleFilter.cs
-
-
- ModuleManager.cs
-
-
- ModuleService.cs
-
-
-
-
-
- {1b5603b4-6f8f-4289-b945-7baae523d740}
- Discord.Net.Commands
-
-
- {8d71a857-879a-4a10-859e-5ff824ed6688}
- Discord.Net
-
-
-
-
-
- project.json
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Discord.Net.Modules.Net45/Properties/AssemblyInfo.cs b/src/Discord.Net.Modules.Net45/Properties/AssemblyInfo.cs
deleted file mode 100644
index 04eda1587..000000000
--- a/src/Discord.Net.Modules.Net45/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Discord.Net.Modules")]
-[assembly: AssemblyDescription("A Discord.Net extension adding basic plugin support.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("RogueException")]
-[assembly: AssemblyProduct("Discord.Net.Modules")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-[assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")]
-
-[assembly: AssemblyVersion("0.9.0.0")]
-[assembly: AssemblyFileVersion("0.9.0.0")]
-
diff --git a/src/Discord.Net.Modules.Net45/project.json b/src/Discord.Net.Modules.Net45/project.json
deleted file mode 100644
index a174430f0..000000000
--- a/src/Discord.Net.Modules.Net45/project.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "dependencies": {
- "Nito.AsyncEx": "3.0.1"
- },
- "frameworks": {
- "net45": { }
- },
- "runtimes": {
- "win": { },
- "win-x86": { },
- "win-x64": { }
- }
-}
\ No newline at end of file
diff --git a/src/Discord.Net.Modules/ModuleChecker.cs b/src/Discord.Net.Modules/ModuleChecker.cs
index 7b54c8a2d..5f9b8e116 100644
--- a/src/Discord.Net.Modules/ModuleChecker.cs
+++ b/src/Discord.Net.Modules/ModuleChecker.cs
@@ -14,9 +14,11 @@ namespace Discord.Modules
_filterType = manager.FilterType;
}
- public bool CanRun(Command command, User user, Channel channel, out string error)
+ public bool CanRun(Command command, User user, ITextChannel channel, out string error)
{
- if (_filterType == ModuleFilter.None || _filterType == ModuleFilter.AlwaysAllowPrivate || _manager.HasChannel(channel))
+ if (_filterType == ModuleFilter.None ||
+ _filterType == ModuleFilter.AlwaysAllowPrivate ||
+ (channel.IsPublic && _manager.HasChannel(channel)))
{
error = null;
return true;
diff --git a/src/Discord.Net.Modules/ModuleExtensions.cs b/src/Discord.Net.Modules/ModuleExtensions.cs
index 070ac9084..a96517c06 100644
--- a/src/Discord.Net.Modules/ModuleExtensions.cs
+++ b/src/Discord.Net.Modules/ModuleExtensions.cs
@@ -4,24 +4,26 @@
{
public static DiscordClient UsingModules(this DiscordClient client)
{
- client.Services.Add(new ModuleService());
+ client.AddService(new ModuleService());
return client;
}
- public static DiscordClient AddModule(this DiscordClient client, T instance, string name = null, ModuleFilter filter = ModuleFilter.None)
- where T : class, IModule
+ public static void AddModule(this DiscordClient client, IModule instance, string name = null, ModuleFilter filter = ModuleFilter.None)
{
- client.Modules().Add(instance, name ?? nameof(T), filter);
- return client;
+ client.GetService().Add(instance, name, filter);
}
- public static DiscordClient AddModule(this DiscordClient client, string name = null, ModuleFilter filter = ModuleFilter.None)
+ public static void AddModule(this DiscordClient client, string name = null, ModuleFilter filter = ModuleFilter.None)
where T : class, IModule, new()
{
- client.Modules().Add(new T(), name ?? nameof(T), filter);
- return client;
+ client.GetService().Add(name, filter);
}
-
- public static ModuleService Modules(this DiscordClient client, bool required = true)
- => client.Services.Get(required);
+ public static void AddModule(this DiscordClient client, T instance, string name = null, ModuleFilter filter = ModuleFilter.None)
+ where T : class, IModule
+ {
+ client.GetService().Add(instance, name, filter);
+ }
+ public static ModuleManager GetModule(this DiscordClient client)
+ where T : class, IModule
+ => client.GetService().Get();
}
}
diff --git a/src/Discord.Net.Modules/ModuleManager.cs b/src/Discord.Net.Modules/ModuleManager.cs
index c2a8d400f..71b5b0c08 100644
--- a/src/Discord.Net.Modules/ModuleManager.cs
+++ b/src/Discord.Net.Modules/ModuleManager.cs
@@ -7,13 +7,19 @@ using System.Linq;
namespace Discord.Modules
{
+ public class ModuleManager : ModuleManager
+ where T : class, IModule
+ {
+ public new T Instance => base.Instance as T;
+
+ internal ModuleManager(DiscordClient client, T instance, string name, ModuleFilter filterType)
+ : base(client, instance, name, filterType)
+ {
+ }
+ }
+
public class ModuleManager
{
- public event EventHandler ServerEnabled = delegate { };
- public event EventHandler ServerDisabled = delegate { };
- public event EventHandler ChannelEnabled = delegate { };
- public event EventHandler ChannelDisabled = delegate { };
-
public event EventHandler JoinedServer = delegate { };
public event EventHandler LeftServer = delegate { };
public event EventHandler ServerUpdated = delegate { };
@@ -32,10 +38,8 @@ namespace Discord.Modules
public event EventHandler UserJoined = delegate { };
public event EventHandler UserLeft = delegate { };
public event EventHandler UserUpdated = delegate { };
- //public event EventHandler UserPresenceUpdated = delegate { };
- //public event EventHandler UserVoiceStateUpdated = delegate { };
public event EventHandler UserUnbanned = delegate { };
- public event EventHandler UserIsTyping = delegate { };
+ public event EventHandler UserIsTyping = delegate { };
public event EventHandler MessageReceived = delegate { };
public event EventHandler MessageSent = delegate { };
@@ -45,7 +49,7 @@ namespace Discord.Modules
private readonly bool _useServerWhitelist, _useChannelWhitelist, _allowAll, _allowPrivate;
private readonly ConcurrentDictionary _enabledServers;
- private readonly ConcurrentDictionary _enabledChannels;
+ private readonly ConcurrentDictionary _enabledChannels;
private readonly ConcurrentDictionary _indirectServers;
private readonly AsyncLock _lock;
@@ -56,7 +60,7 @@ namespace Discord.Modules
public ModuleFilter FilterType { get; }
public IEnumerable EnabledServers => _enabledServers.Select(x => x.Value);
- public IEnumerable EnabledChannels => _enabledChannels.Select(x => x.Value);
+ public IEnumerable EnabledChannels => _enabledChannels.Select(x => x.Value);
internal ModuleManager(DiscordClient client, IModule instance, string name, ModuleFilter filterType)
{
@@ -74,12 +78,17 @@ namespace Discord.Modules
_allowPrivate = filterType.HasFlag(ModuleFilter.AlwaysAllowPrivate);
_enabledServers = new ConcurrentDictionary();
- _enabledChannels = new ConcurrentDictionary();
+ _enabledChannels = new ConcurrentDictionary();
_indirectServers = new ConcurrentDictionary();
if (_allowAll || _useServerWhitelist) //Server-only events
{
- client.ChannelCreated += (s, e) => { if (e.Server != null && HasServer(e.Server)) ChannelCreated(s, e); };
+ client.ChannelCreated += (s, e) =>
+ {
+ var server = (e.Channel as PublicChannel)?.Server;
+ if (HasServer(server))
+ ChannelCreated(s, e);
+ };
//TODO: This *is* a channel update if the before/after voice channel is whitelisted
//client.UserVoiceStateUpdated += (s, e) => { if (HasServer(e.Server)) UserVoiceStateUpdated(s, e); };
}
@@ -105,17 +114,16 @@ namespace Discord.Modules
client.UserJoined += (s, e) => { if (HasIndirectServer(e.Server)) UserJoined(s, e); };
client.UserLeft += (s, e) => { if (HasIndirectServer(e.Server)) UserLeft(s, e); };
+ //TODO: We aren't getting events from UserPresence if AllowPrivate is enabled, but the server we know that user through isn't on the whitelist
client.UserUpdated += (s, e) => { if (HasIndirectServer(e.Server)) UserUpdated(s, e); };
client.UserIsTyping += (s, e) => { if (HasChannel(e.Channel)) UserIsTyping(s, e); };
- //TODO: We aren't getting events from UserPresence if AllowPrivate is enabled, but the server we know that user through isn't on the whitelist
- //client.UserPresenceUpdated += (s, e) => { if (HasIndirectServer(e.Server)) UserPresenceUpdated(s, e); };
client.UserBanned += (s, e) => { if (HasIndirectServer(e.Server)) UserBanned(s, e); };
client.UserUnbanned += (s, e) => { if (HasIndirectServer(e.Server)) UserUnbanned(s, e); };
}
public void CreateCommands(string prefix, Action config)
{
- var commandService = Client.Services.Get();
+ var commandService = Client.GetService();
commandService.CreateGroup(prefix, x =>
{
x.Category(Name);
@@ -144,16 +152,7 @@ namespace Discord.Modules
EnableServerInternal(server);
}
}
- private bool EnableServerInternal(Server server)
- {
- if (_enabledServers.TryAdd(server.Id, server))
- {
- if (ServerEnabled != null)
- ServerEnabled(this, new ServerEventArgs(server));
- return true;
- }
- return false;
- }
+ private bool EnableServerInternal(Server server) => _enabledServers.TryAdd(server.Id, server);
public bool DisableServer(Server server)
{
@@ -161,34 +160,18 @@ namespace Discord.Modules
if (!_useServerWhitelist) return false;
using (_lock.Lock())
- {
- if (_enabledServers.TryRemove(server.Id, out server))
- {
- if (ServerDisabled != null)
- ServerDisabled(this, new ServerEventArgs(server));
- return true;
- }
- return false;
- }
+ return _enabledServers.TryRemove(server.Id, out server);
}
public void DisableAllServers()
{
if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist.");
if (!_useServerWhitelist) return;
- using (_lock.Lock())
- {
- if (ServerDisabled != null)
- {
- foreach (var server in _enabledServers)
- ServerDisabled(this, new ServerEventArgs(server.Value));
- }
-
+ using (_lock.Lock())
_enabledServers.Clear();
- }
}
- public bool EnableChannel(Channel channel)
+ public bool EnableChannel(ITextChannel channel)
{
if (channel == null) throw new ArgumentNullException(nameof(channel));
if (!_useChannelWhitelist) throw new InvalidOperationException("This module is not configured to use a channel whitelist.");
@@ -196,7 +179,7 @@ namespace Discord.Modules
using (_lock.Lock())
return EnableChannelInternal(channel);
}
- public void EnableChannels(IEnumerable channels)
+ public void EnableChannels(IEnumerable channels)
{
if (channels == null) throw new ArgumentNullException(nameof(channels));
if (channels.Contains(null)) throw new ArgumentException("Collection cannot contain null.", nameof(channels));
@@ -208,65 +191,55 @@ namespace Discord.Modules
EnableChannelInternal(channel);
}
}
- private bool EnableChannelInternal(Channel channel)
+ private bool EnableChannelInternal(ITextChannel channel)
{
if (_enabledChannels.TryAdd(channel.Id, channel))
- {
- var server = channel.Server;
- if (server != null)
- {
- int value = 0;
- _indirectServers.TryGetValue(server.Id, out value);
- value++;
- _indirectServers[server.Id] = value;
- }
- if (ChannelEnabled != null)
- ChannelEnabled(this, new ChannelEventArgs(channel));
+ {
+ if (channel.Type != ChannelType.Private)
+ {
+ var server = (channel as PublicChannel)?.Server;
+ int value = 0;
+ _indirectServers.TryGetValue(server.Id, out value);
+ value++;
+ _indirectServers[server.Id] = value;
+ }
return true;
}
return false;
}
- public bool DisableChannel(Channel channel)
+ public bool DisableChannel(IChannel channel)
{
if (channel == null) throw new ArgumentNullException(nameof(channel));
if (!_useChannelWhitelist) return false;
- using (_lock.Lock())
+ IChannel ignored;
+ if (_enabledChannels.TryRemove(channel.Id, out ignored))
{
- Channel ignored;
- if (_enabledChannels.TryRemove(channel.Id, out ignored))
- {
- var server = channel.Server;
- if (server != null)
- {
- int value = 0;
- _indirectServers.TryGetValue(server.Id, out value);
- value--;
- if (value <= 0)
- _indirectServers.TryRemove(server.Id, out value);
- else
- _indirectServers[server.Id] = value;
- }
- if (ChannelDisabled != null)
- ChannelDisabled(this, new ChannelEventArgs(channel));
- return true;
- }
- return false;
- }
- }
+ using (_lock.Lock())
+ {
+ if (channel.Type != ChannelType.Private)
+ {
+ var server = (channel as PublicChannel)?.Server;
+ int value = 0;
+ _indirectServers.TryGetValue(server.Id, out value);
+ value--;
+ if (value <= 0)
+ _indirectServers.TryRemove(server.Id, out value);
+ else
+ _indirectServers[server.Id] = value;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
public void DisableAllChannels()
{
if (!_useChannelWhitelist) return;
using (_lock.Lock())
{
- if (ChannelDisabled != null)
- {
- foreach (var channel in _enabledChannels)
- ChannelDisabled(this, new ChannelEventArgs(channel.Value));
- }
-
_enabledChannels.Clear();
_indirectServers.Clear();
}
@@ -282,20 +255,20 @@ namespace Discord.Modules
internal bool HasServer(Server server) =>
_allowAll ||
- _useServerWhitelist && _enabledServers.ContainsKey(server.Id);
+ (_useServerWhitelist && _enabledServers.ContainsKey(server.Id));
internal bool HasIndirectServer(Server server) =>
_allowAll ||
(_useServerWhitelist && _enabledServers.ContainsKey(server.Id)) ||
(_useChannelWhitelist && _indirectServers.ContainsKey(server.Id));
- internal bool HasChannel(Channel channel)
+ internal bool HasChannel(IChannel channel)
{
if (_allowAll) return true;
- if (channel.IsPrivate) return _allowPrivate;
+ if (channel.Type == ChannelType.Private) return _allowPrivate;
if (_useChannelWhitelist && _enabledChannels.ContainsKey(channel.Id)) return true;
- if (_useServerWhitelist)
+ if (_useServerWhitelist && channel.IsPublic)
{
- var server = channel.Server;
+ var server = (channel as PublicChannel).Server;
if (server == null) return false;
if (_enabledServers.ContainsKey(server.Id)) return true;
}
diff --git a/src/Discord.Net.Modules/ModuleService.cs b/src/Discord.Net.Modules/ModuleService.cs
index 29297f8d4..1f405a222 100644
--- a/src/Discord.Net.Modules/ModuleService.cs
+++ b/src/Discord.Net.Modules/ModuleService.cs
@@ -1,18 +1,23 @@
using System;
using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
namespace Discord.Modules
{
public class ModuleService : IService
{
public DiscordClient Client { get; private set; }
-
- public IEnumerable Modules => _modules.Values;
- private readonly Dictionary _modules;
- public ModuleService()
+ private static readonly MethodInfo addMethod = typeof(ModuleService).GetTypeInfo().GetDeclaredMethods(nameof(Add))
+ .Single(x => x.IsGenericMethodDefinition && x.GetParameters().Length == 3);
+
+ public IEnumerable Modules => _modules.Values;
+ private readonly Dictionary _modules;
+
+ public ModuleService()
{
- _modules = new Dictionary();
+ _modules = new Dictionary();
}
void IService.Install(DiscordClient client)
@@ -20,29 +25,37 @@ namespace Discord.Modules
Client = client;
}
- public T Add(T module, string name, ModuleFilter type)
+ public void Add(IModule instance, string name, ModuleFilter filter)
+ {
+ Type type = instance.GetType();
+ addMethod.MakeGenericMethod(type).Invoke(this, new object[] { instance, name, filter });
+ }
+ public void Add(string name, ModuleFilter filter)
+ where T : class, IModule, new()
+ => Add(new T(), name, filter);
+ public void Add(T instance, string name, ModuleFilter filter)
where T : class, IModule
{
- if (module == null) throw new ArgumentNullException(nameof(module));
- if (name == null) throw new ArgumentNullException(nameof(name));
+ if (instance == null) throw new ArgumentNullException(nameof(instance));
if (Client == null)
throw new InvalidOperationException("Service needs to be added to a DiscordClient before modules can be installed.");
- if (_modules.ContainsKey(module))
+
+ Type type = typeof(T);
+ if (name == null) name = type.Name;
+ if (_modules.ContainsKey(type))
throw new InvalidOperationException("This module has already been added.");
- var manager = new ModuleManager(Client, module, name, type);
- _modules.Add(module, manager);
- module.Install(manager);
- return module;
+ var manager = new ModuleManager(Client, instance, name, filter);
+ _modules.Add(type, manager);
+ instance.Install(manager);
+ }
+ public ModuleManager Get()
+ where T : class, IModule
+ {
+ ModuleManager manager;
+ if (_modules.TryGetValue(typeof(T), out manager))
+ return manager as ModuleManager;
+ return null;
}
-
- public ModuleManager GetManager(IModule module)
- {
- if (module == null) throw new ArgumentNullException(nameof(module));
-
- ModuleManager result = null;
- _modules.TryGetValue(module, out result);
- return result;
- }
}
}
diff --git a/src/Discord.Net.Modules/project.json b/src/Discord.Net.Modules/project.json
index f9834fcf1..e8e897cac 100644
--- a/src/Discord.Net.Modules/project.json
+++ b/src/Discord.Net.Modules/project.json
@@ -1,5 +1,5 @@
{
- "version": "0.9.0-rc3",
+ "version": "1.0.0-alpha1",
"description": "A Discord.Net extension adding basic plugin support.",
"authors": [ "RogueException" ],
"tags": [ "discord", "discordapp" ],
@@ -16,8 +16,8 @@
},
"dependencies": {
- "Discord.Net": "0.9.0-rc3-3",
- "Discord.Net.Commands": "0.9.0-rc3"
+ "Discord.Net": "1.0.0-alpha1",
+ "Discord.Net.Commands": "1.0.0-alpha1"
},
"frameworks": {
"net45": { },
diff --git a/src/Discord.Net.Net45/Discord.Net.csproj b/src/Discord.Net.Net45/Discord.Net.csproj
deleted file mode 100644
index aec38d9d5..000000000
--- a/src/Discord.Net.Net45/Discord.Net.csproj
+++ /dev/null
@@ -1,621 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {8D71A857-879A-4A10-859E-5FF824ED6688}
- Library
- Properties
- Discord
- Discord.Net
- 512
- v4.5
-
-
- False
-
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;NET45
- prompt
- 2
- true
- 6
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE;NET45
- prompt
- 4
- true
- true
- 6
-
-
- true
- bin\FullDebug\
- TRACE;DEBUG;NET45,TEST_RESPONSES
- true
- 2
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
- false
- 6
- true
-
-
-
-
-
-
-
- API\Client\Common\Channel.cs
-
-
- API\Client\Common\ChannelReference.cs
-
-
- API\Client\Common\ExtendedGuild.cs
-
-
- API\Client\Common\ExtendedMember.cs
-
-
- API\Client\Common\Guild.cs
-
-
- API\Client\Common\GuildReference.cs
-
-
- API\Client\Common\Invite.cs
-
-
- API\Client\Common\InviteReference.cs
-
-
- API\Client\Common\Member.cs
-
-
- API\Client\Common\MemberPresence.cs
-
-
- API\Client\Common\MemberReference.cs
-
-
- API\Client\Common\MemberVoiceState.cs
-
-
- API\Client\Common\Message.cs
-
-
- API\Client\Common\MessageReference.cs
-
-
- API\Client\Common\Role.cs
-
-
- API\Client\Common\RoleReference.cs
-
-
- API\Client\Common\User.cs
-
-
- API\Client\Common\UserReference.cs
-
-
- API\Client\GatewaySocket\Commands\Heartbeat.cs
-
-
- API\Client\GatewaySocket\Commands\Identify.cs
-
-
- API\Client\GatewaySocket\Commands\RequestMembers.cs
-
-
- API\Client\GatewaySocket\Commands\Resume.cs
-
-
- API\Client\GatewaySocket\Commands\UpdateStatus.cs
-
-
- API\Client\GatewaySocket\Commands\UpdateVoice.cs
-
-
- API\Client\GatewaySocket\Events\ChannelCreate.cs
-
-
- API\Client\GatewaySocket\Events\ChannelDelete.cs
-
-
- API\Client\GatewaySocket\Events\ChannelUpdate.cs
-
-
- API\Client\GatewaySocket\Events\GuildBanAdd.cs
-
-
- API\Client\GatewaySocket\Events\GuildBanRemove.cs
-
-
- API\Client\GatewaySocket\Events\GuildCreate.cs
-
-
- API\Client\GatewaySocket\Events\GuildDelete.cs
-
-
- API\Client\GatewaySocket\Events\GuildEmojisUpdate.cs
-
-
- API\Client\GatewaySocket\Events\GuildIntegrationsUpdate.cs
-
-
- API\Client\GatewaySocket\Events\GuildMemberAdd.cs
-
-
- API\Client\GatewaySocket\Events\GuildMemberRemove.cs
-
-
- API\Client\GatewaySocket\Events\GuildMembersChunk.cs
-
-
- API\Client\GatewaySocket\Events\GuildMemberUpdate.cs
-
-
- API\Client\GatewaySocket\Events\GuildRoleCreate.cs
-
-
- API\Client\GatewaySocket\Events\GuildRoleDelete.cs
-
-
- API\Client\GatewaySocket\Events\GuildRoleUpdate.cs
-
-
- API\Client\GatewaySocket\Events\GuildUpdate.cs
-
-
- API\Client\GatewaySocket\Events\MessageAck.cs
-
-
- API\Client\GatewaySocket\Events\MessageCreate.cs
-
-
- API\Client\GatewaySocket\Events\MessageDelete.cs
-
-
- API\Client\GatewaySocket\Events\MessageUpdate.cs
-
-
- API\Client\GatewaySocket\Events\PresenceUpdate.cs
-
-
- API\Client\GatewaySocket\Events\Ready.cs
-
-
- API\Client\GatewaySocket\Events\Redirect.cs
-
-
- API\Client\GatewaySocket\Events\Resumed.cs
-
-
- API\Client\GatewaySocket\Events\TypingStart.cs
-
-
- API\Client\GatewaySocket\Events\UserSettingsUpdate.cs
-
-
- API\Client\GatewaySocket\Events\UserUpdate.cs
-
-
- API\Client\GatewaySocket\Events\VoiceServerUpdate.cs
-
-
- API\Client\GatewaySocket\Events\VoiceStateUpdate.cs
-
-
- API\Client\GatewaySocket\OpCodes.cs
-
-
- API\Client\IWebSocketMessage.cs
-
-
- API\Client\Rest\AcceptInvite.cs
-
-
- API\Client\Rest\AckMessage.cs
-
-
- API\Client\Rest\AddChannelPermission.cs
-
-
- API\Client\Rest\AddGuildBan.cs
-
-
- API\Client\Rest\CreateChannel.cs
-
-
- API\Client\Rest\CreateGuild.cs
-
-
- API\Client\Rest\CreateInvite.cs
-
-
- API\Client\Rest\CreatePrivateChannel.cs
-
-
- API\Client\Rest\CreateRole.cs
-
-
- API\Client\Rest\DeleteChannel.cs
-
-
- API\Client\Rest\DeleteInvite.cs
-
-
- API\Client\Rest\DeleteMessage.cs
-
-
- API\Client\Rest\DeleteRole.cs
-
-
- API\Client\Rest\Gateway.cs
-
-
- API\Client\Rest\GetBans.cs
-
-
- API\Client\Rest\GetInvite.cs
-
-
- API\Client\Rest\GetInvites.cs
-
-
- API\Client\Rest\GetMessages.cs
-
-
- API\Client\Rest\GetVoiceRegions.cs
-
-
- API\Client\Rest\GetWidget.cs
-
-
- API\Client\Rest\KickMember.cs
-
-
- API\Client\Rest\LeaveGuild.cs
-
-
- API\Client\Rest\Login.cs
-
-
- API\Client\Rest\Logout.cs
-
-
- API\Client\Rest\PruneMembers.cs
-
-
- API\Client\Rest\RemoveChannelPermission.cs
-
-
- API\Client\Rest\RemoveGuildBan.cs
-
-
- API\Client\Rest\ReorderChannels.cs
-
-
- API\Client\Rest\ReorderRoles.cs
-
-
- API\Client\Rest\SendFile.cs
-
-
- API\Client\Rest\SendIsTyping.cs
-
-
- API\Client\Rest\SendMessage.cs
-
-
- API\Client\Rest\UpdateChannel.cs
-
-
- API\Client\Rest\UpdateGuild.cs
-
-
- API\Client\Rest\UpdateMember.cs
-
-
- API\Client\Rest\UpdateMessage.cs
-
-
- API\Client\Rest\UpdateProfile.cs
-
-
- API\Client\Rest\UpdateRole.cs
-
-
- API\Client\VoiceSocket\Commands\Heartbeat.cs
-
-
- API\Client\VoiceSocket\Commands\Identify.cs
-
-
- API\Client\VoiceSocket\Commands\SelectProtocol.cs
-
-
- API\Client\VoiceSocket\Commands\SetSpeaking.cs
-
-
- API\Client\VoiceSocket\Events\Ready.cs
-
-
- API\Client\VoiceSocket\Events\SessionDescription.cs
-
-
- API\Client\VoiceSocket\Events\Speaking.cs
-
-
- API\Client\VoiceSocket\OpCodes.cs
-
-
- API\Converters.cs
-
-
- API\Extensions.cs
-
-
- API\IRestRequest.cs
-
-
- API\Status\Common\StatusResult.cs
-
-
- API\Status\Rest\ActiveMaintenances.cs
-
-
- API\Status\Rest\AllIncidents.cs
-
-
- API\Status\Rest\UnresolvedIncidents.cs
-
-
- API\Status\Rest\UpcomingMaintenances.cs
-
-
- DiscordClient.cs
-
-
- DiscordClient.Events.cs
-
-
- DiscordConfig.cs
-
-
- DynamicIL.cs
-
-
- Enums\ChannelType.cs
-
-
- Enums\ConnectionState.cs
-
-
- Enums\ImageType.cs
-
-
- Enums\LogSeverity.cs
-
-
- Enums\PermissionBits.cs
-
-
- Enums\PermissionTarget.cs
-
-
- Enums\PermValue.cs
-
-
- Enums\Relative.cs
-
-
- Enums\StringEnum.cs
-
-
- Enums\UserStatus.cs
-
-
- ETF\ETFReader.cs
-
-
- ETF\ETFType.cs
-
-
- ETF\ETFWriter.cs
-
-
- Events\ChannelEventArgs.cs
-
-
- Events\ChannelUpdatedEventArgs.cs
-
-
- Events\ChannelUserEventArgs.cs
-
-
- Events\DisconnectedEventArgs.cs
-
-
- Events\LogMessageEventArgs.cs
-
-
- Events\MessageEventArgs.cs
-
-
- Events\MessageUpdatedEventArgs.cs
-
-
- Events\ProfileUpdatedEventArgs.cs
-
-
- Events\RoleEventArgs.cs
-
-
- Events\RoleUpdatedEventArgs.cs
-
-
- Events\ServerEventArgs.cs
-
-
- Events\ServerUpdatedEventArgs.cs
-
-
- Events\UserEventArgs.cs
-
-
- Events\UserUpdatedEventArgs.cs
-
-
- Extensions.cs
-
-
- Format.cs
-
-
- IMentionable.cs
-
-
- IService.cs
-
-
- Legacy.cs
-
-
- Logging\ILogger.cs
-
-
- Logging\Logger.cs
-
-
- Logging\LogManager.cs
-
-
- MessageQueue.cs
-
-
- Models\Channel.cs
-
-
- Models\Color.cs
-
-
- Models\Invite.cs
-
-
- Models\Message.cs
-
-
- Models\Permissions.cs
-
-
- Models\Profile.cs
-
-
- Models\Region.cs
-
-
- Models\Role.cs
-
-
- Models\Server.cs
-
-
- Models\User.cs
-
-
- Net\HttpException.cs
-
-
- Net\Rest\CompletedRequestEventArgs.cs
-
-
- Net\Rest\ETFRestClient.cs
-
-
- Net\Rest\IRestEngine.cs
-
-
- Net\Rest\JsonRestClient.cs
-
-
- Net\Rest\RequestEventArgs.cs
-
-
- Net\Rest\RestClient.cs
-
-
- Net\Rest\SharpRestEngine.cs
-
-
- Net\TimeoutException.cs
-
-
- Net\WebSockets\WebSocketException.cs
-
-
- Net\WebSockets\BinaryMessageEventArgs.cs
-
-
- Net\WebSockets\BuiltInEngine.cs
-
-
- Net\WebSockets\GatewaySocket.cs
-
-
- Net\WebSockets\IWebSocketEngine.cs
-
-
- Net\WebSockets\TextMessageEventArgs.cs
-
-
- Net\WebSockets\WebSocket.cs
-
-
- Net\WebSockets\WebSocketEventEventArgs.cs
-
-
- Net\WebSockets\WS4NetEngine.cs
-
-
- ServiceManager.cs
-
-
- TaskManager.cs
-
-
-
-
-
- project.json
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Discord.Net.Net45/Properties/AssemblyInfo.cs b/src/Discord.Net.Net45/Properties/AssemblyInfo.cs
deleted file mode 100644
index 64a8616f5..000000000
--- a/src/Discord.Net.Net45/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Discord.Net")]
-[assembly: AssemblyDescription("An unofficial .Net API wrapper for the Discord client.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("RogueException")]
-[assembly: AssemblyProduct("Discord.Net")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-[assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")]
-
-[assembly: AssemblyVersion("0.9.0.0")]
-[assembly: AssemblyFileVersion("0.9.0.0")]
diff --git a/src/Discord.Net.Net45/project.json b/src/Discord.Net.Net45/project.json
deleted file mode 100644
index 82e8e459f..000000000
--- a/src/Discord.Net.Net45/project.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "dependencies": {
- "Newtonsoft.Json": "8.0.1",
- "Nito.AsyncEx": "3.0.1",
- "RestSharp": "105.2.3",
- "WebSocket4Net": "0.14.1"
- },
- "frameworks": {
- "net45": { }
- },
- "runtimes": {
- "win": { },
- "win-x86": { },
- "win-x64": { }
- }
-}
\ No newline at end of file
diff --git a/src/Discord.Net/API/Client/Common/Channel.cs b/src/Discord.Net/API/Client/Common/Channel.cs
index 90ed8bf38..37eac8e48 100644
--- a/src/Discord.Net/API/Client/Common/Channel.cs
+++ b/src/Discord.Net/API/Client/Common/Channel.cs
@@ -29,5 +29,7 @@ namespace Discord.API.Client
public PermissionOverwrite[] PermissionOverwrites { get; set; }
[JsonProperty("recipient")]
public UserReference Recipient { get; set; }
+ [JsonProperty("bitrate")]
+ public int Bitrate { get; set; }
}
}
diff --git a/src/Discord.Net/API/Client/Rest/AcceptInvite.cs b/src/Discord.Net/API/Client/Rest/AcceptInvite.cs
index 865e37c2d..2940c98ac 100644
--- a/src/Discord.Net/API/Client/Rest/AcceptInvite.cs
+++ b/src/Discord.Net/API/Client/Rest/AcceptInvite.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"invite/{InviteId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public string InviteId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/AckMessage.cs b/src/Discord.Net/API/Client/Rest/AckMessage.cs
index 1678ed34b..4cf238b72 100644
--- a/src/Discord.Net/API/Client/Rest/AckMessage.cs
+++ b/src/Discord.Net/API/Client/Rest/AckMessage.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"channels/{ChannelId}/messages/{MessageId}/ack";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
public ulong MessageId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/AddChannelPermission.cs b/src/Discord.Net/API/Client/Rest/AddChannelPermission.cs
index c7a9f57ac..bf725bcaf 100644
--- a/src/Discord.Net/API/Client/Rest/AddChannelPermission.cs
+++ b/src/Discord.Net/API/Client/Rest/AddChannelPermission.cs
@@ -4,12 +4,11 @@ using Newtonsoft.Json;
namespace Discord.API.Client.Rest
{
[JsonObject(MemberSerialization.OptIn)]
- public class AddChannelPermissionsRequest : IRestRequest
+ public class AddOrUpdateChannelPermissionsRequest : IRestRequest
{
string IRestRequest.Method => "PUT";
string IRestRequest.Endpoint => $"channels/{ChannelId}/permissions/{TargetId}";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
@@ -22,7 +21,7 @@ namespace Discord.API.Client.Rest
[JsonProperty("deny")]
public uint Deny { get; set; }
- public AddChannelPermissionsRequest(ulong channelId)
+ public AddOrUpdateChannelPermissionsRequest(ulong channelId)
{
ChannelId = channelId;
}
diff --git a/src/Discord.Net/API/Client/Rest/AddGuildBan.cs b/src/Discord.Net/API/Client/Rest/AddGuildBan.cs
index 7699a74e4..3e0b165f5 100644
--- a/src/Discord.Net/API/Client/Rest/AddGuildBan.cs
+++ b/src/Discord.Net/API/Client/Rest/AddGuildBan.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "PUT";
string IRestRequest.Endpoint => $"guilds/{GuildId}/bans/{UserId}?delete-message-days={PruneDays}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
public ulong UserId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/CreateChannel.cs b/src/Discord.Net/API/Client/Rest/CreateChannel.cs
index 0dc45bc43..90d9afec0 100644
--- a/src/Discord.Net/API/Client/Rest/CreateChannel.cs
+++ b/src/Discord.Net/API/Client/Rest/CreateChannel.cs
@@ -8,14 +8,13 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"guilds/{GuildId}/channels";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("type")]
- public string Type { get; set; }
+ public ChannelType Type { get; set; }
public CreateChannelRequest(ulong guildId)
{
diff --git a/src/Discord.Net/API/Client/Rest/CreateGuild.cs b/src/Discord.Net/API/Client/Rest/CreateGuild.cs
index baa1f455e..a18d2bee9 100644
--- a/src/Discord.Net/API/Client/Rest/CreateGuild.cs
+++ b/src/Discord.Net/API/Client/Rest/CreateGuild.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"guilds";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
[JsonProperty("name")]
public string Name { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/CreateInvite.cs b/src/Discord.Net/API/Client/Rest/CreateInvite.cs
index a55b9c7e9..73f15c248 100644
--- a/src/Discord.Net/API/Client/Rest/CreateInvite.cs
+++ b/src/Discord.Net/API/Client/Rest/CreateInvite.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"channels/{ChannelId}/invites";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/CreatePrivateChannel.cs b/src/Discord.Net/API/Client/Rest/CreatePrivateChannel.cs
index 2d413a8d9..e1087dc36 100644
--- a/src/Discord.Net/API/Client/Rest/CreatePrivateChannel.cs
+++ b/src/Discord.Net/API/Client/Rest/CreatePrivateChannel.cs
@@ -9,7 +9,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"users/@me/channels";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
[JsonProperty("recipient_id"), JsonConverter(typeof(LongStringConverter))]
public ulong RecipientId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/CreateRole.cs b/src/Discord.Net/API/Client/Rest/CreateRole.cs
index 87715490d..3978c6aaa 100644
--- a/src/Discord.Net/API/Client/Rest/CreateRole.cs
+++ b/src/Discord.Net/API/Client/Rest/CreateRole.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"guilds/{GuildId}/roles";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/DeleteChannel.cs b/src/Discord.Net/API/Client/Rest/DeleteChannel.cs
index 6443c2387..ae56934b5 100644
--- a/src/Discord.Net/API/Client/Rest/DeleteChannel.cs
+++ b/src/Discord.Net/API/Client/Rest/DeleteChannel.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "DELETE";
string IRestRequest.Endpoint => $"channels/{ChannelId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/DeleteGuild.cs b/src/Discord.Net/API/Client/Rest/DeleteGuild.cs
new file mode 100644
index 000000000..44df5892e
--- /dev/null
+++ b/src/Discord.Net/API/Client/Rest/DeleteGuild.cs
@@ -0,0 +1,19 @@
+using Newtonsoft.Json;
+
+namespace Discord.API.Client.Rest
+{
+ [JsonObject(MemberSerialization.OptIn)]
+ public class DeleteGuildRequest : IRestRequest
+ {
+ string IRestRequest.Method => "DELETE";
+ string IRestRequest.Endpoint => $"guilds/{GuildId}";
+ object IRestRequest.Payload => null;
+
+ public ulong GuildId { get; set; }
+
+ public DeleteGuildRequest(ulong guildId)
+ {
+ GuildId = guildId;
+ }
+ }
+}
diff --git a/src/Discord.Net/API/Client/Rest/DeleteInvite.cs b/src/Discord.Net/API/Client/Rest/DeleteInvite.cs
index 5de8b348b..4bfe1e0d7 100644
--- a/src/Discord.Net/API/Client/Rest/DeleteInvite.cs
+++ b/src/Discord.Net/API/Client/Rest/DeleteInvite.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "DELETE";
string IRestRequest.Endpoint => $"invite/{InviteCode}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public string InviteCode { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/DeleteMessage.cs b/src/Discord.Net/API/Client/Rest/DeleteMessage.cs
index 33921cd1a..3f781a756 100644
--- a/src/Discord.Net/API/Client/Rest/DeleteMessage.cs
+++ b/src/Discord.Net/API/Client/Rest/DeleteMessage.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "DELETE";
string IRestRequest.Endpoint => $"channels/{ChannelId}/messages/{MessageId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
public ulong MessageId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/DeleteRole.cs b/src/Discord.Net/API/Client/Rest/DeleteRole.cs
index 650ece9f2..56faf3d33 100644
--- a/src/Discord.Net/API/Client/Rest/DeleteRole.cs
+++ b/src/Discord.Net/API/Client/Rest/DeleteRole.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "DELETE";
string IRestRequest.Endpoint => $"guilds/{GuildId}/roles/{RoleId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
public ulong RoleId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/Gateway.cs b/src/Discord.Net/API/Client/Rest/Gateway.cs
index ef9486ca1..02dd71008 100644
--- a/src/Discord.Net/API/Client/Rest/Gateway.cs
+++ b/src/Discord.Net/API/Client/Rest/Gateway.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"gateway";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
}
public class GatewayResponse
diff --git a/src/Discord.Net/API/Client/Rest/GetBans.cs b/src/Discord.Net/API/Client/Rest/GetBans.cs
index ee07cb242..714cdbaf8 100644
--- a/src/Discord.Net/API/Client/Rest/GetBans.cs
+++ b/src/Discord.Net/API/Client/Rest/GetBans.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"guilds/{GuildId}/bans";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/GetInvite.cs b/src/Discord.Net/API/Client/Rest/GetInvite.cs
index 27de264f0..2531ac26a 100644
--- a/src/Discord.Net/API/Client/Rest/GetInvite.cs
+++ b/src/Discord.Net/API/Client/Rest/GetInvite.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"invite/{InviteCode}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public string InviteCode { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/GetInvites.cs b/src/Discord.Net/API/Client/Rest/GetInvites.cs
index 079c54ef5..2b4f2f5fe 100644
--- a/src/Discord.Net/API/Client/Rest/GetInvites.cs
+++ b/src/Discord.Net/API/Client/Rest/GetInvites.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"guilds/{GuildId}/invites";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/GetMessages.cs b/src/Discord.Net/API/Client/Rest/GetMessages.cs
index b72b05c8b..1beadb9a9 100644
--- a/src/Discord.Net/API/Client/Rest/GetMessages.cs
+++ b/src/Discord.Net/API/Client/Rest/GetMessages.cs
@@ -19,7 +19,6 @@ namespace Discord.API.Client.Rest
}
}
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/GetVoiceRegions.cs b/src/Discord.Net/API/Client/Rest/GetVoiceRegions.cs
index 7dc97ef31..df21cc203 100644
--- a/src/Discord.Net/API/Client/Rest/GetVoiceRegions.cs
+++ b/src/Discord.Net/API/Client/Rest/GetVoiceRegions.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"voice/regions";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
}
public class GetVoiceRegionsResponse
diff --git a/src/Discord.Net/API/Client/Rest/GetWidget.cs b/src/Discord.Net/API/Client/Rest/GetWidget.cs
index 3b1006358..0437a8b6b 100644
--- a/src/Discord.Net/API/Client/Rest/GetWidget.cs
+++ b/src/Discord.Net/API/Client/Rest/GetWidget.cs
@@ -9,7 +9,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"servers/{GuildId}/widget.json";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/KickMember.cs b/src/Discord.Net/API/Client/Rest/KickMember.cs
index 96804ff6b..4808f8543 100644
--- a/src/Discord.Net/API/Client/Rest/KickMember.cs
+++ b/src/Discord.Net/API/Client/Rest/KickMember.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "DELETE";
string IRestRequest.Endpoint => $"guilds/{GuildId}/members/{UserId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
public ulong UserId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/LeaveGuild.cs b/src/Discord.Net/API/Client/Rest/LeaveGuild.cs
index 6a8b3c0cf..99fd8cbe7 100644
--- a/src/Discord.Net/API/Client/Rest/LeaveGuild.cs
+++ b/src/Discord.Net/API/Client/Rest/LeaveGuild.cs
@@ -6,9 +6,8 @@ namespace Discord.API.Client.Rest
public class LeaveGuildRequest : IRestRequest
{
string IRestRequest.Method => "DELETE";
- string IRestRequest.Endpoint => $"guilds/{GuildId}";
+ string IRestRequest.Endpoint => $"users/@me/guilds/{GuildId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/Login.cs b/src/Discord.Net/API/Client/Rest/Login.cs
index ab7efc31b..f9c89c717 100644
--- a/src/Discord.Net/API/Client/Rest/Login.cs
+++ b/src/Discord.Net/API/Client/Rest/Login.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => Email != null ? "POST" : "GET";
string IRestRequest.Endpoint => $"auth/login";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
[JsonProperty("email", NullValueHandling = NullValueHandling.Ignore)]
public string Email { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/Logout.cs b/src/Discord.Net/API/Client/Rest/Logout.cs
index 78f8059e5..9f4443c51 100644
--- a/src/Discord.Net/API/Client/Rest/Logout.cs
+++ b/src/Discord.Net/API/Client/Rest/Logout.cs
@@ -8,6 +8,5 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"auth/logout";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
}
}
diff --git a/src/Discord.Net/API/Client/Rest/PruneMembers.cs b/src/Discord.Net/API/Client/Rest/PruneMembers.cs
index 41771f7d6..e80498bb1 100644
--- a/src/Discord.Net/API/Client/Rest/PruneMembers.cs
+++ b/src/Discord.Net/API/Client/Rest/PruneMembers.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => IsSimulation ? "GET" : "POST";
string IRestRequest.Endpoint => $"guilds/{GuildId}/prune?days={Days}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/RemoveChannelPermission.cs b/src/Discord.Net/API/Client/Rest/RemoveChannelPermission.cs
index c704eadbc..b453cba49 100644
--- a/src/Discord.Net/API/Client/Rest/RemoveChannelPermission.cs
+++ b/src/Discord.Net/API/Client/Rest/RemoveChannelPermission.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "DELETE";
string IRestRequest.Endpoint => $"channels/{ChannelId}/permissions/{TargetId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
public ulong TargetId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/RemoveGuildBan.cs b/src/Discord.Net/API/Client/Rest/RemoveGuildBan.cs
index c6d48c944..5a8f4f796 100644
--- a/src/Discord.Net/API/Client/Rest/RemoveGuildBan.cs
+++ b/src/Discord.Net/API/Client/Rest/RemoveGuildBan.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "DELETE";
string IRestRequest.Endpoint => $"guilds/{GuildId}/bans/{UserId}";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
public ulong UserId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/ReorderChannels.cs b/src/Discord.Net/API/Client/Rest/ReorderChannels.cs
index c481eda43..c13f8b21c 100644
--- a/src/Discord.Net/API/Client/Rest/ReorderChannels.cs
+++ b/src/Discord.Net/API/Client/Rest/ReorderChannels.cs
@@ -17,7 +17,6 @@ namespace Discord.API.Client.Rest
return ChannelIds.Select(x => new Channel(x, pos++));
}
}
- bool IRestRequest.IsPrivate => false;
public class Channel
{
diff --git a/src/Discord.Net/API/Client/Rest/ReorderRoles.cs b/src/Discord.Net/API/Client/Rest/ReorderRoles.cs
index 23d73541f..300176a76 100644
--- a/src/Discord.Net/API/Client/Rest/ReorderRoles.cs
+++ b/src/Discord.Net/API/Client/Rest/ReorderRoles.cs
@@ -17,7 +17,6 @@ namespace Discord.API.Client.Rest
return RoleIds.Select(x => new Role(x, pos++));
}
}
- bool IRestRequest.IsPrivate => false;
public class Role
{
diff --git a/src/Discord.Net/API/Client/Rest/SendFile.cs b/src/Discord.Net/API/Client/Rest/SendFile.cs
index 8d072d0e3..4b59e1a11 100644
--- a/src/Discord.Net/API/Client/Rest/SendFile.cs
+++ b/src/Discord.Net/API/Client/Rest/SendFile.cs
@@ -9,7 +9,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"channels/{ChannelId}/messages";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
string IRestFileRequest.Filename => Filename;
Stream IRestFileRequest.Stream => Stream;
diff --git a/src/Discord.Net/API/Client/Rest/SendIsTyping.cs b/src/Discord.Net/API/Client/Rest/SendIsTyping.cs
index aab017c67..4c56da0be 100644
--- a/src/Discord.Net/API/Client/Rest/SendIsTyping.cs
+++ b/src/Discord.Net/API/Client/Rest/SendIsTyping.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"channels/{ChannelId}/typing";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/SendMessage.cs b/src/Discord.Net/API/Client/Rest/SendMessage.cs
index 6c6d1ae10..9caca991d 100644
--- a/src/Discord.Net/API/Client/Rest/SendMessage.cs
+++ b/src/Discord.Net/API/Client/Rest/SendMessage.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "POST";
string IRestRequest.Endpoint => $"channels/{ChannelId}/messages";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/UpdateChannel.cs b/src/Discord.Net/API/Client/Rest/UpdateChannel.cs
index cccd4b096..8a82caefd 100644
--- a/src/Discord.Net/API/Client/Rest/UpdateChannel.cs
+++ b/src/Discord.Net/API/Client/Rest/UpdateChannel.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "PATCH";
string IRestRequest.Endpoint => $"channels/{ChannelId}";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
@@ -18,6 +17,8 @@ namespace Discord.API.Client.Rest
public string Topic { get; set; }
[JsonProperty("position")]
public int Position { get; set; }
+ [JsonProperty("bitrate")]
+ public int Bitrate { get; set; }
public UpdateChannelRequest(ulong channelId)
{
diff --git a/src/Discord.Net/API/Client/Rest/UpdateGuild.cs b/src/Discord.Net/API/Client/Rest/UpdateGuild.cs
index 4ff530554..f36b18d9f 100644
--- a/src/Discord.Net/API/Client/Rest/UpdateGuild.cs
+++ b/src/Discord.Net/API/Client/Rest/UpdateGuild.cs
@@ -9,7 +9,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "PATCH";
string IRestRequest.Endpoint => $"guilds/{GuildId}";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/UpdateMember.cs b/src/Discord.Net/API/Client/Rest/UpdateMember.cs
index 019c4ee99..ce1649bdd 100644
--- a/src/Discord.Net/API/Client/Rest/UpdateMember.cs
+++ b/src/Discord.Net/API/Client/Rest/UpdateMember.cs
@@ -9,7 +9,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "PATCH";
string IRestRequest.Endpoint => $"guilds/{GuildId}/members/{UserId}";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
public ulong UserId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/UpdateMessage.cs b/src/Discord.Net/API/Client/Rest/UpdateMessage.cs
index df3ca46c0..fc055b2bc 100644
--- a/src/Discord.Net/API/Client/Rest/UpdateMessage.cs
+++ b/src/Discord.Net/API/Client/Rest/UpdateMessage.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "PATCH";
string IRestRequest.Endpoint => $"channels/{ChannelId}/messages/{MessageId}";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong ChannelId { get; set; }
public ulong MessageId { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/UpdateProfile.cs b/src/Discord.Net/API/Client/Rest/UpdateProfile.cs
index 08f28d868..0f0cdb313 100644
--- a/src/Discord.Net/API/Client/Rest/UpdateProfile.cs
+++ b/src/Discord.Net/API/Client/Rest/UpdateProfile.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "PATCH";
string IRestRequest.Endpoint => $"users/@me";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
[JsonProperty("password")]
public string CurrentPassword { get; set; }
diff --git a/src/Discord.Net/API/Client/Rest/UpdateRole.cs b/src/Discord.Net/API/Client/Rest/UpdateRole.cs
index 7aac774b7..4bea0b52b 100644
--- a/src/Discord.Net/API/Client/Rest/UpdateRole.cs
+++ b/src/Discord.Net/API/Client/Rest/UpdateRole.cs
@@ -8,7 +8,6 @@ namespace Discord.API.Client.Rest
string IRestRequest.Method => "PATCH";
string IRestRequest.Endpoint => $"guilds/{GuildId}/roles/{RoleId}";
object IRestRequest.Payload => this;
- bool IRestRequest.IsPrivate => false;
public ulong GuildId { get; set; }
public ulong RoleId { get; set; }
diff --git a/src/Discord.Net/API/IRestRequest.cs b/src/Discord.Net/API/IRestRequest.cs
index b8c7b818c..af520370d 100644
--- a/src/Discord.Net/API/IRestRequest.cs
+++ b/src/Discord.Net/API/IRestRequest.cs
@@ -7,7 +7,6 @@ namespace Discord.API
string Method { get; }
string Endpoint { get; }
object Payload { get; }
- bool IsPrivate { get; }
}
public interface IRestRequest : IRestRequest
where ResponseT : class
diff --git a/src/Discord.Net/API/Status/Rest/ActiveMaintenances.cs b/src/Discord.Net/API/Status/Rest/ActiveMaintenances.cs
index 638c176a5..639f85f08 100644
--- a/src/Discord.Net/API/Status/Rest/ActiveMaintenances.cs
+++ b/src/Discord.Net/API/Status/Rest/ActiveMaintenances.cs
@@ -8,6 +8,5 @@ namespace Discord.API.Status.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"scheduled-maintenances/active.json";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
}
}
diff --git a/src/Discord.Net/API/Status/Rest/AllIncidents.cs b/src/Discord.Net/API/Status/Rest/AllIncidents.cs
index 81a82ce51..9575bbd43 100644
--- a/src/Discord.Net/API/Status/Rest/AllIncidents.cs
+++ b/src/Discord.Net/API/Status/Rest/AllIncidents.cs
@@ -8,6 +8,5 @@ namespace Discord.API.Status.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"incidents.json";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
}
}
diff --git a/src/Discord.Net/API/Status/Rest/UnresolvedIncidents.cs b/src/Discord.Net/API/Status/Rest/UnresolvedIncidents.cs
index 1665dde75..3cff11c23 100644
--- a/src/Discord.Net/API/Status/Rest/UnresolvedIncidents.cs
+++ b/src/Discord.Net/API/Status/Rest/UnresolvedIncidents.cs
@@ -8,6 +8,5 @@ namespace Discord.API.Status.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"incidents/unresolved.json";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
}
}
diff --git a/src/Discord.Net/API/Status/Rest/UpcomingMaintenances.cs b/src/Discord.Net/API/Status/Rest/UpcomingMaintenances.cs
index afc812cc9..803a8a630 100644
--- a/src/Discord.Net/API/Status/Rest/UpcomingMaintenances.cs
+++ b/src/Discord.Net/API/Status/Rest/UpcomingMaintenances.cs
@@ -8,6 +8,5 @@ namespace Discord.API.Status.Rest
string IRestRequest.Method => "GET";
string IRestRequest.Endpoint => $"scheduled-maintenances/upcoming.json";
object IRestRequest.Payload => null;
- bool IRestRequest.IsPrivate => false;
}
}
diff --git a/src/Discord.Net/DiscordClient.Events.cs b/src/Discord.Net/DiscordClient.Events.cs
index 5d2577627..b05725f9b 100644
--- a/src/Discord.Net/DiscordClient.Events.cs
+++ b/src/Discord.Net/DiscordClient.Events.cs
@@ -5,7 +5,7 @@ namespace Discord
{
public partial class DiscordClient
{
- public event EventHandler LoggedIn = delegate { };
+ public event EventHandler Ready = delegate { };
//public event EventHandler LoggedOut = delegate { };
public event EventHandler ChannelCreated = delegate { };
public event EventHandler ChannelDestroyed = delegate { };
@@ -25,22 +25,22 @@ namespace Discord
public event EventHandler ServerUpdated = delegate { };
public event EventHandler