RogueException 9 years ago
parent
commit
a0f21d6c1d
14 changed files with 193 additions and 10 deletions
  1. +18
    -0
      Discord.Net.sln
  2. +2
    -2
      src/Discord.Net.Commands.Net45/Properties/AssemblyInfo.cs
  3. +2
    -2
      src/Discord.Net.Commands/project.json
  4. +56
    -0
      src/Discord.Net.Modules.Net45/Discord.Net.Modules.csproj
  5. +18
    -0
      src/Discord.Net.Modules.Net45/Properties/AssemblyInfo.cs
  6. +21
    -0
      src/Discord.Net.Modules/Discord.Net.Modules.xproj
  7. +22
    -0
      src/Discord.Net.Modules/project.json
  8. +2
    -2
      src/Discord.Net.Net45/Properties/AssemblyInfo.cs
  9. +6
    -1
      src/Discord.Net/API/Members.cs
  10. +15
    -0
      src/Discord.Net/API/Messages.cs
  11. +12
    -1
      src/Discord.Net/DiscordClient.Users.cs
  12. +11
    -0
      src/Discord.Net/DiscordClient.cs
  13. +7
    -1
      src/Discord.Net/Net/WebSockets/DataWebSocket.cs
  14. +1
    -1
      src/Discord.Net/project.json

+ 18
- 0
Discord.Net.sln View File

@@ -26,6 +26,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net", "src\Discord.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Commands", "src\Discord.Net.Commands.Net45\Discord.Net.Commands.csproj", "{1B5603B4-6F8F-4289-B945-7BAAE523D740}"
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
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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}.Release|Any CPU.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -75,5 +91,7 @@ Global
{855D6B1D-847B-42DA-BE6A-23683EA89511} = {6317A2E6-8E36-4C3E-949B-3F10EC888AB9}
{8D71A857-879A-4A10-859E-5FF824ED6688} = {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
EndGlobal

+ 2
- 2
src/Discord.Net.Commands.Net45/Properties/AssemblyInfo.cs View File

@@ -13,6 +13,6 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[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")]


+ 2
- 2
src/Discord.Net.Commands/project.json View File

@@ -1,5 +1,5 @@
{
"version": "0.8.0-beta1",
"version": "0.8.1-beta1",
"description": "A Discord.Net extension adding basic command support.",
"authors": [ "RogueException" ],
"tags": [ "discord", "discordapp" ],
@@ -13,7 +13,7 @@
"warningsAsErrors": true
},
"dependencies": {
"Discord.Net": "0.8.0-beta1"
"Discord.Net": "0.8.1-beta1"
},
"frameworks": {
"net45": { },


+ 56
- 0
src/Discord.Net.Modules.Net45/Discord.Net.Modules.csproj View File

@@ -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>

+ 18
- 0
src/Discord.Net.Modules.Net45/Properties/AssemblyInfo.cs View File

@@ -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")]


+ 21
- 0
src/Discord.Net.Modules/Discord.Net.Modules.xproj View File

@@ -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>

+ 22
- 0
src/Discord.Net.Modules/project.json View File

@@ -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": { }
}
}

+ 2
- 2
src/Discord.Net.Net45/Properties/AssemblyInfo.cs View File

@@ -13,5 +13,5 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[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")]

+ 6
- 1
src/Discord.Net/API/Members.cs View File

@@ -92,5 +92,10 @@ namespace Discord.API
internal sealed class MemberAddEvent : MemberInfo { }
internal sealed class MemberUpdateEvent : 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;
}
}

+ 15
- 0
src/Discord.Net/API/Messages.cs View File

@@ -125,6 +125,21 @@ namespace Discord.API
//Get
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
internal sealed class MessageCreateEvent : MessageInfo { }
internal sealed class MessageUpdateEvent : MessageInfo { }


+ 12
- 1
src/Discord.Net/DiscordClient.Users.cs View File

@@ -169,7 +169,10 @@ namespace Discord
if (user == null) throw new ArgumentNullException(nameof(user));
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)
@@ -202,6 +205,14 @@ namespace Discord
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 = "",
string username = null, string email = null, string password = null,
ImageType avatarType = ImageType.Png, byte[] avatar = null)


+ 11
- 0
src/Discord.Net/DiscordClient.cs View File

@@ -418,6 +418,17 @@ namespace Discord
RaiseUserRemoved(user);
}
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
case "GUILD_ROLE_CREATE":


+ 7
- 1
src/Discord.Net/Net/WebSockets/DataWebSocket.cs View File

@@ -27,7 +27,7 @@ namespace Discord.Net.WebSockets
msg.Payload.Token = token;
msg.Payload.Properties["$device"] = "Discord.Net";
if (_client.Config.UseLargeThreshold)
msg.Payload.LargeThreshold = 50;
msg.Payload.LargeThreshold = 100;
msg.Payload.Compress = true;
QueueMessage(msg);
}
@@ -141,5 +141,11 @@ namespace Discord.Net.WebSockets
leaveVoice.Payload.ServerId = serverId;
QueueMessage(leaveVoice);
}
public void SendGetUsers(string serverId, string query = "", int limit = 0)
{
var getOfflineUsers = new GetUsersCommand();
getOfflineUsers.Payload.ServerId = serverId;
QueueMessage(getOfflineUsers);
}
}
}

+ 1
- 1
src/Discord.Net/project.json View File

@@ -1,5 +1,5 @@
{
"version": "0.8.0-beta1",
"version": "0.8.1-beta1",
"description": "An unofficial .Net API wrapper for the Discord client.",
"authors": [
"RogueException"


Loading…
Cancel
Save