This commit is contained in:
RogueException
2015-10-28 23:10:43 -03:00
14 changed files with 193 additions and 10 deletions

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

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

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>

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

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>

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

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

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;
}
}

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 { }

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)

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":

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);
}
}
}

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"