| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
907925c9ad | Force CI to deploy | 8 years ago |
|
|
e5dcbb8135 | Force CI to build | 8 years ago |
|
|
a4994365c4 | Bumped version to 1.0.2 | 8 years ago |
|
|
b38eb8b819 |
Create unspecified channel object for unknown channel types (#811)
* Partial fix of #810, addresses critical connection issues. * Implement fix for REST. * Implement fix on RestChannel. |
8 years ago |
| @@ -1,6 +1,6 @@ | |||||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
| <PropertyGroup> | <PropertyGroup> | ||||
| <VersionPrefix>1.0.1</VersionPrefix> | |||||
| <VersionPrefix>1.0.2</VersionPrefix> | |||||
| <VersionSuffix></VersionSuffix> | <VersionSuffix></VersionSuffix> | ||||
| <Authors>RogueException</Authors> | <Authors>RogueException</Authors> | ||||
| <PackageTags>discord;discordapp</PackageTags> | <PackageTags>discord;discordapp</PackageTags> | ||||
| @@ -28,4 +28,4 @@ | |||||
| <WarningsAsErrors>true</WarningsAsErrors> | <WarningsAsErrors>true</WarningsAsErrors> | ||||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||||
| </PropertyGroup> | </PropertyGroup> | ||||
| </Project> | |||||
| </Project> | |||||
| @@ -1,7 +1,7 @@ | |||||
| version: build-{build} | version: build-{build} | ||||
| branches: | branches: | ||||
| only: | only: | ||||
| - dev | |||||
| - release/1.0.2 | |||||
| image: Visual Studio 2017 | image: Visual Studio 2017 | ||||
| nuget: | nuget: | ||||
| @@ -51,11 +51,11 @@ deploy: | |||||
| secure: Jl7BXeUjRnkVHDMBuUWSXcEOkrli1PBleW2IiLyUs5j63UNUNp1hcjaUJRujx9lz | secure: Jl7BXeUjRnkVHDMBuUWSXcEOkrli1PBleW2IiLyUs5j63UNUNp1hcjaUJRujx9lz | ||||
| symbol_server: https://www.myget.org/F/discord-net/symbols/api/v2/package | symbol_server: https://www.myget.org/F/discord-net/symbols/api/v2/package | ||||
| on: | on: | ||||
| branch: dev | |||||
| branch: release/1.0.2 | |||||
| - provider: NuGet | - provider: NuGet | ||||
| server: https://www.myget.org/F/rogueexception/api/v2/package | server: https://www.myget.org/F/rogueexception/api/v2/package | ||||
| api_key: | api_key: | ||||
| secure: D+vW2O2LBf/iJb4f+q8fkyIW2VdIYIGxSYLWNrOD4BHlDBZQlJipDbNarWjUr2Kn | secure: D+vW2O2LBf/iJb4f+q8fkyIW2VdIYIGxSYLWNrOD4BHlDBZQlJipDbNarWjUr2Kn | ||||
| symbol_server: https://www.myget.org/F/rogueexception/symbols/api/v2/package | symbol_server: https://www.myget.org/F/rogueexception/symbols/api/v2/package | ||||
| on: | on: | ||||
| branch: dev | |||||
| branch: dev | |||||
| @@ -6,7 +6,7 @@ using Model = Discord.API.Channel; | |||||
| namespace Discord.Rest | namespace Discord.Rest | ||||
| { | { | ||||
| public abstract class RestChannel : RestEntity<ulong>, IChannel, IUpdateable | |||||
| public class RestChannel : RestEntity<ulong>, IChannel, IUpdateable | |||||
| { | { | ||||
| public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | ||||
| @@ -25,7 +25,7 @@ namespace Discord.Rest | |||||
| case ChannelType.Group: | case ChannelType.Group: | ||||
| return CreatePrivate(discord, model) as RestChannel; | return CreatePrivate(discord, model) as RestChannel; | ||||
| default: | default: | ||||
| throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); | |||||
| return new RestChannel(discord, model.Id); | |||||
| } | } | ||||
| } | } | ||||
| internal static IRestPrivateChannel CreatePrivate(BaseDiscordClient discord, Model model) | internal static IRestPrivateChannel CreatePrivate(BaseDiscordClient discord, Model model) | ||||
| @@ -40,9 +40,9 @@ namespace Discord.Rest | |||||
| throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); | throw new InvalidOperationException($"Unexpected channel type: {model.Type}"); | ||||
| } | } | ||||
| } | } | ||||
| internal abstract void Update(Model model); | |||||
| internal virtual void Update(Model model) { } | |||||
| public abstract Task UpdateAsync(RequestOptions options = null); | |||||
| public virtual Task UpdateAsync(RequestOptions options = null) => Task.Delay(0); | |||||
| //IChannel | //IChannel | ||||
| string IChannel.Name => null; | string IChannel.Name => null; | ||||
| @@ -7,7 +7,7 @@ using Model = Discord.API.Channel; | |||||
| namespace Discord.Rest | namespace Discord.Rest | ||||
| { | { | ||||
| public abstract class RestGuildChannel : RestChannel, IGuildChannel, IUpdateable | |||||
| public class RestGuildChannel : RestChannel, IGuildChannel, IUpdateable | |||||
| { | { | ||||
| private ImmutableArray<Overwrite> _overwrites; | private ImmutableArray<Overwrite> _overwrites; | ||||
| @@ -33,7 +33,8 @@ namespace Discord.Rest | |||||
| case ChannelType.Voice: | case ChannelType.Voice: | ||||
| return RestVoiceChannel.Create(discord, guild, model); | return RestVoiceChannel.Create(discord, guild, model); | ||||
| default: | default: | ||||
| throw new InvalidOperationException("Unknown guild channel type"); | |||||
| // TODO: Channel categories | |||||
| return new RestGuildChannel(discord, guild, model.Id); | |||||
| } | } | ||||
| } | } | ||||
| internal override void Update(Model model) | internal override void Update(Model model) | ||||
| @@ -10,7 +10,7 @@ using Model = Discord.API.Channel; | |||||
| namespace Discord.WebSocket | namespace Discord.WebSocket | ||||
| { | { | ||||
| [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
| public abstract class SocketGuildChannel : SocketChannel, IGuildChannel | |||||
| public class SocketGuildChannel : SocketChannel, IGuildChannel | |||||
| { | { | ||||
| private ImmutableArray<Overwrite> _overwrites; | private ImmutableArray<Overwrite> _overwrites; | ||||
| @@ -19,7 +19,7 @@ namespace Discord.WebSocket | |||||
| public int Position { get; private set; } | public int Position { get; private set; } | ||||
| public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; | public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; | ||||
| public new abstract IReadOnlyCollection<SocketGuildUser> Users { get; } | |||||
| public new virtual IReadOnlyCollection<SocketGuildUser> Users => ImmutableArray.Create<SocketGuildUser>(); | |||||
| internal SocketGuildChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) | internal SocketGuildChannel(DiscordSocketClient discord, ulong id, SocketGuild guild) | ||||
| : base(discord, id) | : base(discord, id) | ||||
| @@ -35,7 +35,8 @@ namespace Discord.WebSocket | |||||
| case ChannelType.Voice: | case ChannelType.Voice: | ||||
| return SocketVoiceChannel.Create(guild, state, model); | return SocketVoiceChannel.Create(guild, state, model); | ||||
| default: | default: | ||||
| throw new InvalidOperationException("Unknown guild channel type"); | |||||
| // TODO: Proper implementation for channel categories | |||||
| return new SocketGuildChannel(guild.Discord, model.Id, guild); | |||||
| } | } | ||||
| } | } | ||||
| internal override void Update(ClientState state, Model model) | internal override void Update(ClientState state, Model model) | ||||
| @@ -49,7 +50,7 @@ namespace Discord.WebSocket | |||||
| newOverwrites.Add(overwrites[i].ToEntity()); | newOverwrites.Add(overwrites[i].ToEntity()); | ||||
| _overwrites = newOverwrites.ToImmutable(); | _overwrites = newOverwrites.ToImmutable(); | ||||
| } | } | ||||
| public Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | public Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | ||||
| => ChannelHelper.ModifyAsync(this, Discord, func, options); | => ChannelHelper.ModifyAsync(this, Discord, func, options); | ||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| @@ -115,7 +116,7 @@ namespace Discord.WebSocket | |||||
| public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | ||||
| => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | ||||
| public new abstract SocketGuildUser GetUser(ulong id); | |||||
| public new virtual SocketGuildUser GetUser(ulong id) => null; | |||||
| public override string ToString() => Name; | public override string ToString() => Name; | ||||
| internal new SocketGuildChannel Clone() => MemberwiseClone() as SocketGuildChannel; | internal new SocketGuildChannel Clone() => MemberwiseClone() as SocketGuildChannel; | ||||
| @@ -145,7 +146,7 @@ namespace Discord.WebSocket | |||||
| => await RemovePermissionOverwriteAsync(role, options).ConfigureAwait(false); | => await RemovePermissionOverwriteAsync(role, options).ConfigureAwait(false); | ||||
| async Task IGuildChannel.RemovePermissionOverwriteAsync(IUser user, RequestOptions options) | async Task IGuildChannel.RemovePermissionOverwriteAsync(IUser user, RequestOptions options) | ||||
| => await RemovePermissionOverwriteAsync(user, options).ConfigureAwait(false); | => await RemovePermissionOverwriteAsync(user, options).ConfigureAwait(false); | ||||
| IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options) | IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options) | ||||
| => ImmutableArray.Create<IReadOnlyCollection<IGuildUser>>(Users).ToAsyncEnumerable(); | => ImmutableArray.Create<IReadOnlyCollection<IGuildUser>>(Users).ToAsyncEnumerable(); | ||||
| Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) | Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options) | ||||
| @@ -2,7 +2,7 @@ | |||||
| <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||||
| <metadata> | <metadata> | ||||
| <id>Discord.Net</id> | <id>Discord.Net</id> | ||||
| <version>1.0.1$suffix$</version> | |||||
| <version>1.0.2$suffix$</version> | |||||
| <title>Discord.Net</title> | <title>Discord.Net</title> | ||||
| <authors>RogueException</authors> | <authors>RogueException</authors> | ||||
| <owners>RogueException</owners> | <owners>RogueException</owners> | ||||
| @@ -13,29 +13,29 @@ | |||||
| <requireLicenseAcceptance>false</requireLicenseAcceptance> | <requireLicenseAcceptance>false</requireLicenseAcceptance> | ||||
| <dependencies> | <dependencies> | ||||
| <group targetFramework="net45"> | <group targetFramework="net45"> | ||||
| <dependency id="Discord.Net.Core" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Rest" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.WebSocket" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Rpc" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Commands" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Webhook" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Core" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Rest" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.WebSocket" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Rpc" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Commands" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Webhook" version="1.0.2$suffix$" /> | |||||
| </group> | </group> | ||||
| <group targetFramework="netstandard1.1"> | <group targetFramework="netstandard1.1"> | ||||
| <dependency id="Discord.Net.Core" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Rest" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.WebSocket" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Rpc" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Commands" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Webhook" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Core" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Rest" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.WebSocket" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Rpc" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Commands" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Webhook" version="1.0.2$suffix$" /> | |||||
| </group> | </group> | ||||
| <group targetFramework="netstandard1.3"> | <group targetFramework="netstandard1.3"> | ||||
| <dependency id="Discord.Net.Core" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Rest" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.WebSocket" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Rpc" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Commands" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Webhook" version="1.0.1$suffix$" /> | |||||
| <dependency id="Discord.Net.Core" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Rest" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.WebSocket" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Rpc" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Commands" version="1.0.2$suffix$" /> | |||||
| <dependency id="Discord.Net.Webhook" version="1.0.2$suffix$" /> | |||||
| </group> | </group> | ||||
| </dependencies> | </dependencies> | ||||
| </metadata> | </metadata> | ||||
| </package> | |||||
| </package> | |||||