| @@ -0,0 +1,174 @@ | |||||
| --- | |||||
| uid: Discord.GuildChannelProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IGuildChannel.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| var channel = _client.GetChannel(id) as IGuildChannel; | |||||
| if (channel == null) return; | |||||
| await channel.ModifyAsync(x => | |||||
| { | |||||
| x.Name = "new-name"; | |||||
| x.Position = channel.Position - 1; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.TextChannelProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.ITextChannel.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| var channel = _client.GetChannel(id) as ITextChannel; | |||||
| if (channel == null) return; | |||||
| await channel.ModifyAsync(x => | |||||
| { | |||||
| x.Name = "cool-guys-only"; | |||||
| x.Topic = "This channel is only for cool guys and adults!!!"; | |||||
| x.Position = channel.Position - 1; | |||||
| x.IsNsfw = true; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.VoiceChannelProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IVoiceChannel.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| var channel = _client.GetChannel(id) as IVoiceChannel; | |||||
| if (channel == null) return; | |||||
| await channel.ModifyAsync(x => | |||||
| { | |||||
| x.UserLimit = 5; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.EmoteProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IGuild.ModifyEmoteAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| await guild.ModifyEmoteAsync(x => | |||||
| { | |||||
| x.Name = "blobo"; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.MessageProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IUserMessage.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| var message = await channel.SendMessageAsync("boo"); | |||||
| await Task.Delay(TimeSpan.FromSeconds(1)); | |||||
| await message.ModifyAsync(x => x.Content = "boi"); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.GuildProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IGuild.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| var guild = _client.GetGuild(id); | |||||
| if (guild == null) return; | |||||
| await guild.ModifyAsync(x => | |||||
| { | |||||
| x.Name = "VERY Fast Discord Running at Incredible Hihg Speed"; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.RoleProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IRole.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| var role = guild.GetRole(id); | |||||
| if (role == null) return; | |||||
| await role.ModifyAsync(x => | |||||
| { | |||||
| x.Name = "cool boi"; | |||||
| x.Color = Color.Gold; | |||||
| x.Hoist = true; | |||||
| x.Mentionable = true; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.GuildUserProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IGuildUser.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| var user = guild.GetUser(id); | |||||
| if (user == null) return; | |||||
| await user.ModifyAsync(x => | |||||
| { | |||||
| x.Nickname = "I need healing"; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.SelfUserProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.ISelfUser.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| await selfUser.ModifyAsync(x => | |||||
| { | |||||
| x.Username = "Mercy"; | |||||
| }); | |||||
| ``` | |||||
| --- | |||||
| uid: Discord.WebhookProperties | |||||
| example: [*content] | |||||
| --- | |||||
| The following example uses @Discord.IWebhook.ModifyAsync* to | |||||
| apply changes specified in the properties, | |||||
| ```cs | |||||
| await webhook.ModifyAsync(x => | |||||
| { | |||||
| x.Name = "very fast fox"; | |||||
| x.ChannelId = newChannelId; | |||||
| }); | |||||
| ``` | |||||
| @@ -3,14 +3,7 @@ namespace Discord | |||||
| /// <summary> | /// <summary> | ||||
| /// Properties that are used to modify an <see cref="IGuildChannel" /> with the specified changes. | /// Properties that are used to modify an <see cref="IGuildChannel" /> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <example> | |||||
| /// <code lang="c#"> | |||||
| /// await (Context.Channel as ITextChannel)?.ModifyAsync(x => | |||||
| /// { | |||||
| /// x.Name = "do-not-enter"; | |||||
| /// }); | |||||
| /// </code> | |||||
| /// </example> | |||||
| /// <seealso cref="IGuildChannel.ModifyAsync"/> | |||||
| public class GuildChannelProperties | public class GuildChannelProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| @@ -1,8 +1,11 @@ | |||||
| using System; | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// Properties that are used to modify an <see cref="ITextChannel"/> with the specified changes. | /// Properties that are used to modify an <see cref="ITextChannel"/> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <seealso cref="ITextChannel.ModifyAsync(Action{TextChannelProperties}, RequestOptions)"/> | |||||
| public class TextChannelProperties : GuildChannelProperties | public class TextChannelProperties : GuildChannelProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| @@ -5,6 +5,7 @@ namespace Discord | |||||
| /// <summary> | /// <summary> | ||||
| /// Properties that are used to modify an <see cref="Emote" /> with the specified changes. | /// Properties that are used to modify an <see cref="Emote" /> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <seealso cref="IGuild.ModifyEmoteAsync"/> | |||||
| public class EmoteProperties | public class EmoteProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| @@ -3,28 +3,19 @@ namespace Discord | |||||
| /// <summary> | /// <summary> | ||||
| /// Properties that are used to modify an <see cref="IGuild" /> with the specified changes. | /// Properties that are used to modify an <see cref="IGuild" /> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <example> | |||||
| /// <code lang="c#"> | |||||
| /// await Context.Guild.ModifyAsync(async x => | |||||
| /// { | |||||
| /// x.Name = "aaaaaah"; | |||||
| /// }); | |||||
| /// </code> | |||||
| /// </example> | |||||
| /// <see cref="T:Discord.IGuild" /> | |||||
| /// <see cref="IGuild.ModifyAsync" /> | |||||
| public class GuildProperties | public class GuildProperties | ||||
| { | { | ||||
| public Optional<string> Username { get; set; } | |||||
| /// <summary> | /// <summary> | ||||
| /// Gets or sets the name of the Guild. | |||||
| /// Gets or sets the name of the guild. Must be within 100 characters. | |||||
| /// </summary> | /// </summary> | ||||
| public Optional<string> Name { get; set; } | public Optional<string> Name { get; set; } | ||||
| /// <summary> | /// <summary> | ||||
| /// Gets or sets the region for the Guild's voice connections. | |||||
| /// Gets or sets the region for the guild's voice connections. | |||||
| /// </summary> | /// </summary> | ||||
| public Optional<IVoiceRegion> Region { get; set; } | public Optional<IVoiceRegion> Region { get; set; } | ||||
| /// <summary> | /// <summary> | ||||
| /// Gets or sets the ID of the region for the Guild's voice connections. | |||||
| /// Gets or sets the ID of the region for the guild's voice connections. | |||||
| /// </summary> | /// </summary> | ||||
| public Optional<string> RegionId { get; set; } | public Optional<string> RegionId { get; set; } | ||||
| /// <summary> | /// <summary> | ||||
| @@ -4,23 +4,9 @@ namespace Discord | |||||
| /// Properties that are used to modify an <see cref="IUserMessage" /> with the specified changes. | /// Properties that are used to modify an <see cref="IUserMessage" /> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <remarks> | /// <remarks> | ||||
| /// The content of a message can be cleared with <see cref="string.Empty"/> if and only if an <see cref="Discord.Embed"/> is present. | |||||
| /// The content of a message can be cleared with <see cref="System.String.Empty"/> if and only if an <see cref="Discord.Embed"/> is present. | |||||
| /// </remarks> | /// </remarks> | ||||
| /// <example> | |||||
| /// <code lang="c#"> | |||||
| /// var message = await ReplyAsync("abc"); | |||||
| /// await message.ModifyAsync(x => | |||||
| /// { | |||||
| /// x.Content = ""; | |||||
| /// x.Embed = new EmbedBuilder() | |||||
| /// .WithColor(new Color(40, 40, 120)) | |||||
| /// .WithAuthor(a => a.Name = "foxbot") | |||||
| /// .WithTitle("Embed!") | |||||
| /// .WithDescription("This is an embed.") | |||||
| /// .Build(); | |||||
| /// }); | |||||
| /// </code> | |||||
| /// </example> | |||||
| /// <seealso cref="IUserMessage.ModifyAsync"/> | |||||
| public class MessageProperties | public class MessageProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| @@ -3,16 +3,7 @@ namespace Discord | |||||
| /// <summary> | /// <summary> | ||||
| /// Properties that are used to modify an <see cref="IRole" /> with the specified changes. | /// Properties that are used to modify an <see cref="IRole" /> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <example> | |||||
| /// <code lang="c#"> | |||||
| /// await role.ModifyAsync(x => | |||||
| /// { | |||||
| /// x.Color = new Color(180, 15, 40); | |||||
| /// x.Hoist = true; | |||||
| /// }); | |||||
| /// </code> | |||||
| /// </example> | |||||
| /// <seealso cref="T:Discord.IRole" /> | |||||
| /// <seealso cref="IRole.ModifyAsync" /> | |||||
| public class RoleProperties | public class RoleProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| @@ -5,15 +5,7 @@ namespace Discord | |||||
| /// <summary> | /// <summary> | ||||
| /// Properties that are used to modify an <see cref="IGuildUser" /> with the following parameters. | /// Properties that are used to modify an <see cref="IGuildUser" /> with the following parameters. | ||||
| /// </summary> | /// </summary> | ||||
| /// <example> | |||||
| /// <code lang="c#"> | |||||
| /// await guildUser.ModifyAsync(x => | |||||
| /// { | |||||
| /// x.Nickname = $"festive {guildUser.Username}"; | |||||
| /// }); | |||||
| /// </code> | |||||
| /// </example> | |||||
| /// <seealso cref="T:Discord.IGuildUser" /> | |||||
| /// <seealso cref="IGuildUser.ModifyAsync" /> | |||||
| public class GuildUserProperties | public class GuildUserProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| @@ -3,15 +3,7 @@ namespace Discord | |||||
| /// <summary> | /// <summary> | ||||
| /// Properties that are used to modify the <see cref="ISelfUser" /> with the specified changes. | /// Properties that are used to modify the <see cref="ISelfUser" /> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <example> | |||||
| /// <code lang="c#"> | |||||
| /// await Context.Client.CurrentUser.ModifyAsync(x => | |||||
| /// { | |||||
| /// x.Avatar = new Image(File.OpenRead("avatar.jpg")); | |||||
| /// }); | |||||
| /// </code> | |||||
| /// </example> | |||||
| /// <seealso cref="T:Discord.ISelfUser" /> | |||||
| /// <seealso cref="ISelfUser.ModifyAsync" /> | |||||
| public class SelfUserProperties | public class SelfUserProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| @@ -3,16 +3,7 @@ namespace Discord | |||||
| /// <summary> | /// <summary> | ||||
| /// Properties used to modify an <see cref="IWebhook" /> with the specified changes. | /// Properties used to modify an <see cref="IWebhook" /> with the specified changes. | ||||
| /// </summary> | /// </summary> | ||||
| /// <example> | |||||
| /// <code lang="c#"> | |||||
| /// await webhook.ModifyAsync(x => | |||||
| /// { | |||||
| /// x.Name = "Bob"; | |||||
| /// x.Avatar = new Image("avatar.jpg"); | |||||
| /// }); | |||||
| /// </code> | |||||
| /// </example> | |||||
| /// <seealso cref="T:Discord.IWebhook" /> | |||||
| /// <seealso cref="IWebhook.ModifyAsync"/> | |||||
| public class WebhookProperties | public class WebhookProperties | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||