Browse Source

Fixed bugs with creating invites

tags/1.0-rc
RogueException 8 years ago
parent
commit
d9fd0c34e4
4 changed files with 7 additions and 3 deletions
  1. +4
    -0
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
  2. +1
    -1
      src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
  3. +1
    -1
      src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs
  4. +1
    -1
      src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs

+ 4
- 0
src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs View File

@@ -74,8 +74,12 @@ namespace Discord.Rest
var args = new CreateChannelInviteParams { IsTemporary = isTemporary }; var args = new CreateChannelInviteParams { IsTemporary = isTemporary };
if (maxAge.HasValue) if (maxAge.HasValue)
args.MaxAge = maxAge.Value; args.MaxAge = maxAge.Value;
else
args.MaxAge = 0;
if (maxUses.HasValue) if (maxUses.HasValue)
args.MaxUses = maxUses.Value; args.MaxUses = maxUses.Value;
else
args.MaxUses = 0;
var model = await client.ApiClient.CreateChannelInviteAsync(channel.Id, args, options).ConfigureAwait(false); var model = await client.ApiClient.CreateChannelInviteAsync(channel.Id, args, options).ConfigureAwait(false);
return RestInviteMetadata.Create(client, null, channel, model); return RestInviteMetadata.Create(client, null, channel, model);
} }


+ 1
- 1
src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs View File

@@ -118,7 +118,7 @@ namespace Discord.Rest


public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false);
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = true, RequestOptions options = null)
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, RequestOptions options = null)
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false); => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false);


public override string ToString() => Name; public override string ToString() => Name;


+ 1
- 1
src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs View File

@@ -51,7 +51,7 @@ namespace Discord.Rpc


public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false);
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = true, RequestOptions options = null)
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, RequestOptions options = null)
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false); => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false);


public override string ToString() => Name; public override string ToString() => Name;


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs View File

@@ -112,7 +112,7 @@ namespace Discord.WebSocket


public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false);
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = true, RequestOptions options = null)
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, RequestOptions options = null)
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false); => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false);


public new abstract SocketGuildUser GetUser(ulong id); public new abstract SocketGuildUser GetUser(ulong id);


Loading…
Cancel
Save