| @@ -82,11 +82,6 @@ namespace Discord | |||||
| /// <summary> Gets a collection of all invites to this guild. </summary> | /// <summary> Gets a collection of all invites to this guild. </summary> | ||||
| Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(); | Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(); | ||||
| /// <summary> Creates a new invite to this guild. </summary> | |||||
| /// <param name="maxAge"> The time (in seconds) until the invite expires. Set to null to never expire. </param> | |||||
| /// <param name="maxUses"> The max amount of times this invite may be used. Set to null to have unlimited uses. </param> | |||||
| /// <param name="isTemporary"> If true, a user accepting this invite will be kicked from the guild after closing their client. </param> | |||||
| Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false); | |||||
| /// <summary> Gets the role in this guild with the provided id, or null if not found. </summary> | /// <summary> Gets the role in this guild with the provided id, or null if not found. </summary> | ||||
| IRole GetRole(ulong id); | IRole GetRole(ulong id); | ||||
| @@ -220,20 +220,6 @@ namespace Discord | |||||
| var models = await Discord.ApiClient.GetGuildInvitesAsync(Id).ConfigureAwait(false); | var models = await Discord.ApiClient.GetGuildInvitesAsync(Id).ConfigureAwait(false); | ||||
| return models.Select(x => new InviteMetadata(Discord, x)).ToImmutableArray(); | return models.Select(x => new InviteMetadata(Discord, x)).ToImmutableArray(); | ||||
| } | } | ||||
| public async Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 1800, int? maxUses = null, bool isTemporary = false) | |||||
| { | |||||
| if (maxAge <= 0) throw new ArgumentOutOfRangeException(nameof(maxAge)); | |||||
| if (maxUses <= 0) throw new ArgumentOutOfRangeException(nameof(maxUses)); | |||||
| var args = new CreateChannelInviteParams() | |||||
| { | |||||
| MaxAge = maxAge ?? 0, | |||||
| MaxUses = maxUses ?? 0, | |||||
| Temporary = isTemporary | |||||
| }; | |||||
| var model = await Discord.ApiClient.CreateChannelInviteAsync(DefaultChannelId, args).ConfigureAwait(false); | |||||
| return new InviteMetadata(Discord, model); | |||||
| } | |||||
| public Role GetRole(ulong id) | public Role GetRole(ulong id) | ||||
| { | { | ||||