| @@ -26,6 +26,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net", "src\Discord. | |||||
| EndProject | EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Commands", "src\Discord.Net.Commands.Net45\Discord.Net.Commands.csproj", "{1B5603B4-6F8F-4289-B945-7BAAE523D740}" | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Commands", "src\Discord.Net.Commands.Net45\Discord.Net.Commands.csproj", "{1B5603B4-6F8F-4289-B945-7BAAE523D740}" | ||||
| EndProject | EndProject | ||||
| Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Discord.Net.Modules", "src\Discord.Net.Modules\Discord.Net.Modules.xproj", "{01584E8A-78DA-486F-9EF9-A894E435841B}" | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Modules", "src\Discord.Net.Modules.Net45\Discord.Net.Modules.csproj", "{3091164F-66AE-4543-A63D-167C1116241D}" | |||||
| EndProject | |||||
| Global | Global | ||||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| Debug|Any CPU = Debug|Any CPU | Debug|Any CPU = Debug|Any CPU | ||||
| @@ -63,6 +67,18 @@ Global | |||||
| {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = Debug|Any CPU | {1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = Debug|Any CPU | ||||
| {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.ActiveCfg = Release|Any CPU | {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = Release|Any CPU | {1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| {01584E8A-78DA-486F-9EF9-A894E435841B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {01584E8A-78DA-486F-9EF9-A894E435841B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {01584E8A-78DA-486F-9EF9-A894E435841B}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {01584E8A-78DA-486F-9EF9-A894E435841B}.FullDebug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {01584E8A-78DA-486F-9EF9-A894E435841B}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {01584E8A-78DA-486F-9EF9-A894E435841B}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| EndGlobalSection | EndGlobalSection | ||||
| GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
| HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
| @@ -75,5 +91,7 @@ Global | |||||
| {855D6B1D-847B-42DA-BE6A-23683EA89511} = {6317A2E6-8E36-4C3E-949B-3F10EC888AB9} | {855D6B1D-847B-42DA-BE6A-23683EA89511} = {6317A2E6-8E36-4C3E-949B-3F10EC888AB9} | ||||
| {8D71A857-879A-4A10-859E-5FF824ED6688} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | {8D71A857-879A-4A10-859E-5FF824ED6688} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | ||||
| {1B5603B4-6F8F-4289-B945-7BAAE523D740} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | {1B5603B4-6F8F-4289-B945-7BAAE523D740} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | ||||
| {01584E8A-78DA-486F-9EF9-A894E435841B} = {EA68EBE2-51C8-4440-9EF7-D633C90A5D35} | |||||
| {3091164F-66AE-4543-A63D-167C1116241D} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | |||||
| EndGlobalSection | EndGlobalSection | ||||
| EndGlobal | EndGlobal | ||||
| @@ -13,6 +13,6 @@ using System.Runtime.InteropServices; | |||||
| [assembly: ComVisible(false)] | [assembly: ComVisible(false)] | ||||
| [assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")] | [assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")] | ||||
| [assembly: AssemblyVersion("0.8.0.0")] | |||||
| [assembly: AssemblyFileVersion("0.8.0.0")] | |||||
| [assembly: AssemblyVersion("0.8.1.0")] | |||||
| [assembly: AssemblyFileVersion("0.8.1.0")] | |||||
| @@ -1,5 +1,5 @@ | |||||
| { | { | ||||
| "version": "0.8.0-beta1", | |||||
| "version": "0.8.1-beta1", | |||||
| "description": "A Discord.Net extension adding basic command support.", | "description": "A Discord.Net extension adding basic command support.", | ||||
| "authors": [ "RogueException" ], | "authors": [ "RogueException" ], | ||||
| "tags": [ "discord", "discordapp" ], | "tags": [ "discord", "discordapp" ], | ||||
| @@ -13,7 +13,7 @@ | |||||
| "warningsAsErrors": true | "warningsAsErrors": true | ||||
| }, | }, | ||||
| "dependencies": { | "dependencies": { | ||||
| "Discord.Net": "0.8.0-beta1" | |||||
| "Discord.Net": "0.8.1-beta1" | |||||
| }, | }, | ||||
| "frameworks": { | "frameworks": { | ||||
| "net45": { }, | "net45": { }, | ||||
| @@ -0,0 +1,56 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||||
| <ProjectGuid>{3091164F-66AE-4543-A63D-167C1116241D}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>Discord</RootNamespace> | |||||
| <AssemblyName>Discord.Net.Commands</AssemblyName> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||||
| <UseMSBuildEngine>False</UseMSBuildEngine> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <DebugType>full</DebugType> | |||||
| <Optimize>false</Optimize> | |||||
| <OutputPath>bin\Debug\</OutputPath> | |||||
| <DefineConstants>TRACE;DEBUG;NET45</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| <LangVersion>6</LangVersion> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <Optimize>true</Optimize> | |||||
| <OutputPath>bin\Release\</OutputPath> | |||||
| <DefineConstants>TRACE;NET45</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | |||||
| <LangVersion>6</LangVersion> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="System" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\Discord.Net.Net45\Discord.Net.csproj"> | |||||
| <Project>{8d71a857-879a-4a10-859e-5ff824ed6688}</Project> | |||||
| <Name>Discord.Net</Name> | |||||
| </ProjectReference> | |||||
| </ItemGroup> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||||
| Other similar extension points exist, see Microsoft.Common.targets. | |||||
| <Target Name="BeforeBuild"> | |||||
| </Target> | |||||
| <Target Name="AfterBuild"> | |||||
| </Target> | |||||
| --> | |||||
| </Project> | |||||
| @@ -0,0 +1,18 @@ | |||||
| 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.8.1.0")] | |||||
| [assembly: AssemblyFileVersion("0.8.1.0")] | |||||
| @@ -0,0 +1,21 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | |||||
| <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> | |||||
| <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | |||||
| </PropertyGroup> | |||||
| <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" /> | |||||
| <PropertyGroup Label="Globals"> | |||||
| <ProjectGuid>01584e8a-78da-486f-9ef9-a894e435841b</ProjectGuid> | |||||
| <RootNamespace>Discord</RootNamespace> | |||||
| <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> | |||||
| <OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup> | |||||
| <SchemaVersion>2.0</SchemaVersion> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | |||||
| <ProduceOutputsOnBuild>True</ProduceOutputsOnBuild> | |||||
| </PropertyGroup> | |||||
| <Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" /> | |||||
| </Project> | |||||
| @@ -0,0 +1,22 @@ | |||||
| { | |||||
| "version": "0.8.1-beta1", | |||||
| "description": "A Discord.Net extension adding basic plugin support.", | |||||
| "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" | |||||
| }, | |||||
| "compilationOptions": { | |||||
| "warningsAsErrors": true | |||||
| }, | |||||
| "dependencies": { | |||||
| "Discord.Net": "0.8.1-beta1" | |||||
| }, | |||||
| "frameworks": { | |||||
| "net45": { }, | |||||
| "dnx451": { } | |||||
| } | |||||
| } | |||||
| @@ -13,5 +13,5 @@ using System.Runtime.InteropServices; | |||||
| [assembly: ComVisible(false)] | [assembly: ComVisible(false)] | ||||
| [assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")] | [assembly: Guid("76ea00e6-ea24-41e1-acb2-639c0313fa80")] | ||||
| [assembly: AssemblyVersion("0.8.0")] | |||||
| [assembly: AssemblyFileVersion("0.8.0")] | |||||
| [assembly: AssemblyVersion("0.8.1.0")] | |||||
| [assembly: AssemblyFileVersion("0.8.1.0")] | |||||
| @@ -92,5 +92,10 @@ namespace Discord.API | |||||
| internal sealed class MemberAddEvent : MemberInfo { } | internal sealed class MemberAddEvent : MemberInfo { } | ||||
| internal sealed class MemberUpdateEvent : MemberInfo { } | internal sealed class MemberUpdateEvent : MemberInfo { } | ||||
| internal sealed class MemberRemoveEvent : MemberInfo { } | internal sealed class MemberRemoveEvent : MemberInfo { } | ||||
| internal sealed class MemberVoiceStateUpdateEvent : VoiceMemberInfo { } | |||||
| internal sealed class MemberVoiceStateUpdateEvent : VoiceMemberInfo { } | |||||
| internal sealed class MembersChunkEvent | |||||
| { | |||||
| [JsonProperty("members")] | |||||
| public MemberInfo[] Members; | |||||
| } | |||||
| } | } | ||||
| @@ -125,6 +125,21 @@ namespace Discord.API | |||||
| //Get | //Get | ||||
| public sealed class GetMessagesResponse : List<MessageInfo> { } | public sealed class GetMessagesResponse : List<MessageInfo> { } | ||||
| //Commands | |||||
| internal sealed class GetUsersCommand : WebSocketMessage<GetUsersCommand.Data> | |||||
| { | |||||
| public GetUsersCommand() : base(8) { } | |||||
| public class Data | |||||
| { | |||||
| [JsonProperty("guild_id")] | |||||
| public string ServerId; | |||||
| [JsonProperty("query")] | |||||
| public string Query; | |||||
| [JsonProperty("limit")] | |||||
| public int Limit; | |||||
| } | |||||
| } | |||||
| //Events | //Events | ||||
| internal sealed class MessageCreateEvent : MessageInfo { } | internal sealed class MessageCreateEvent : MessageInfo { } | ||||
| internal sealed class MessageUpdateEvent : MessageInfo { } | internal sealed class MessageUpdateEvent : MessageInfo { } | ||||
| @@ -169,7 +169,10 @@ namespace Discord | |||||
| if (user == null) throw new ArgumentNullException(nameof(user)); | if (user == null) throw new ArgumentNullException(nameof(user)); | ||||
| CheckReady(); | CheckReady(); | ||||
| return _api.EditUser(user.Server?.Id, user.Id, mute: mute, deaf: deaf, roles: roles.Select(x => x.Id)); | |||||
| var serverId = user.Server?.Id; | |||||
| return _api.EditUser(serverId, user.Id, | |||||
| mute: mute, deaf: deaf, | |||||
| roles: roles.Select(x => x.Id).Where(x => x != serverId)); | |||||
| } | } | ||||
| public Task KickUser(User user) | public Task KickUser(User user) | ||||
| @@ -202,6 +205,14 @@ namespace Discord | |||||
| return response.Pruned ?? 0; | return response.Pruned ?? 0; | ||||
| } | } | ||||
| /// <summary>When Config.UseLargeThreshold is enabled, running this command will request the Discord server to provide you with all offline users for a particular server.</summary> | |||||
| public void RequestOfflineUsers(string serverId) | |||||
| { | |||||
| if (serverId == null) throw new ArgumentNullException(nameof(serverId)); | |||||
| _dataSocket.SendGetUsers(serverId); | |||||
| } | |||||
| public Task EditProfile(string currentPassword = "", | public Task EditProfile(string currentPassword = "", | ||||
| string username = null, string email = null, string password = null, | string username = null, string email = null, string password = null, | ||||
| ImageType avatarType = ImageType.Png, byte[] avatar = null) | ImageType avatarType = ImageType.Png, byte[] avatar = null) | ||||
| @@ -418,6 +418,17 @@ namespace Discord | |||||
| RaiseUserRemoved(user); | RaiseUserRemoved(user); | ||||
| } | } | ||||
| break; | break; | ||||
| case "GUILD_MEMBERS_CHUNK": | |||||
| { | |||||
| var data = e.Payload.ToObject<MembersChunkEvent>(_serializer); | |||||
| foreach (var memberData in data.Members) | |||||
| { | |||||
| var user = _users.GetOrAdd(memberData.User.Id, memberData.GuildId); | |||||
| user.Update(memberData); | |||||
| //RaiseUserAdded(user); | |||||
| } | |||||
| } | |||||
| break; | |||||
| //Roles | //Roles | ||||
| case "GUILD_ROLE_CREATE": | case "GUILD_ROLE_CREATE": | ||||
| @@ -27,7 +27,7 @@ namespace Discord.Net.WebSockets | |||||
| msg.Payload.Token = token; | msg.Payload.Token = token; | ||||
| msg.Payload.Properties["$device"] = "Discord.Net"; | msg.Payload.Properties["$device"] = "Discord.Net"; | ||||
| if (_client.Config.UseLargeThreshold) | if (_client.Config.UseLargeThreshold) | ||||
| msg.Payload.LargeThreshold = 50; | |||||
| msg.Payload.LargeThreshold = 100; | |||||
| msg.Payload.Compress = true; | msg.Payload.Compress = true; | ||||
| QueueMessage(msg); | QueueMessage(msg); | ||||
| } | } | ||||
| @@ -141,5 +141,11 @@ namespace Discord.Net.WebSockets | |||||
| leaveVoice.Payload.ServerId = serverId; | leaveVoice.Payload.ServerId = serverId; | ||||
| QueueMessage(leaveVoice); | QueueMessage(leaveVoice); | ||||
| } | } | ||||
| public void SendGetUsers(string serverId, string query = "", int limit = 0) | |||||
| { | |||||
| var getOfflineUsers = new GetUsersCommand(); | |||||
| getOfflineUsers.Payload.ServerId = serverId; | |||||
| QueueMessage(getOfflineUsers); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| { | { | ||||
| "version": "0.8.0-beta1", | |||||
| "version": "0.8.1-beta1", | |||||
| "description": "An unofficial .Net API wrapper for the Discord client.", | "description": "An unofficial .Net API wrapper for the Discord client.", | ||||
| "authors": [ | "authors": [ | ||||
| "RogueException" | "RogueException" | ||||