public static async Task <DiscordInvite> CreateInviteAsync(this DiscordClient client, ulong channelId, InviteProperties properties = null) { if (properties == null) { properties = new InviteProperties(); } return((await client.HttpClient.PostAsync($"/channels/{channelId}/invites", properties)) .ParseDeterministic <DiscordInvite>().SetClient(client)); }
/// <summary> /// Creates an invite for a channel /// </summary> /// <param name="channelId">ID of the channel</param> /// <param name="properties">Options for creating the invite</param> /// <returns>The created invite</returns> public static Invite CreateInvite(this DiscordClient client, ulong channelId, InviteProperties properties = null) { if (properties == null) { properties = new InviteProperties(); } return(client.HttpClient.Post($"/channels/{channelId}/invites", properties) .Deserialize <Invite>().SetClient(client)); }
public static PartialInvite CreateInvite(this DiscordClient client, long channelId, InviteProperties properties = null) { if (properties == null) { properties = new InviteProperties(); } return(client.HttpClient.Post($"/channels/{channelId}/invites", JsonConvert.SerializeObject(properties)) .Deserialize <PartialInvite>().SetClient(client)); }
public static Invite CreateInvite(this DiscordClient client, long channelId, InviteProperties properties) { var resp = client.HttpClient.Post($"/channels/{channelId}/invites", JsonConvert.SerializeObject(properties)); if (resp.StatusCode == HttpStatusCode.NotFound) { throw new ChannelNotFoundException(client, channelId); } Invite invite = JsonConvert.DeserializeObject <Invite>(resp.Content.ReadAsStringAsync().Result); invite.Client = client; return(invite); }
public PartialInvite CreateInvite(InviteProperties properties = null) { return(Client.CreateInvite(Id, properties)); }
/// <summary> /// Creates an invite /// </summary> /// <param name="properties">Options for creating the invite</param> /// <returns></returns> public DiscordInvite CreateInvite(InviteProperties properties = null) { return(Client.CreateInvite(Id, properties)); }
/// <summary> /// Creates an invite for the channel /// </summary> /// <param name="properties">Options for creating the invite</param> /// <returns>The created invite</returns> public DiscordInvite CreateInvite(InviteProperties properties = null) { return(CreateInviteAsync(properties).GetAwaiter().GetResult()); }
public async Task <DiscordInvite> CreateInviteAsync(InviteProperties properties = null) { return(await Client.CreateInviteAsync(Id, properties)); }
public Invite CreateInvite(InviteProperties properties) { return(Client.CreateInvite(Id, properties)); }
/// <summary> /// Creates an invite for a channel /// </summary> /// <param name="channelId">ID of the channel</param> /// <param name="properties">Options for creating the invite</param> /// <returns>The created invite</returns> public static DiscordInvite CreateInvite(this DiscordClient client, ulong channelId, InviteProperties properties = null) { return(client.CreateInviteAsync(channelId, properties).GetAwaiter().GetResult()); }