public class WelcomeScreenChannel : ISnowflakeEntity
{
/// <summary>
/// Gets the channel's id.
/// </summary>
public ulong Id { get; }
/// <summary>
/// Gets the description shown for the channel.
/// </summary>
public string Description { get; }
/// <summary>
/// Gets the emoji for this channel. <see cref="Emoji"/> if it is unicode emoji, <see cref="Emote"/> if it is a custom one and <see langword="null"/> if none is set.
/// </summary>
/// <remarks>
/// If the emoji is <see cref="Emote"/> only the <see cref="Emote.Id"/> will be populated.
/// Use <see cref="IGuild.GetEmoteAsync"/> to get the emoji.
/// </remarks>
public IEmote Emoji { get; }
/// <inheritdoc/>
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
public class WelcomeScreenChannelProperties : ISnowflakeEntity
{
/// <summary>
/// Gets or sets the channel's id.
/// </summary>
public ulong Id { get; set; }
/// <summary>
/// Gets or sets the description shown for the channel.
/// </summary>
public string Description { get; set; }
/// <summary>
/// Gets or sets the emoji for this channel. <see cref="Emoji"/> if it is unicode emoji, <see cref="Emote"/> if it is a custom one and <see langword="null"/> if none is set.
/// </summary>
/// <remarks>
/// If the emoji is <see cref="Emote"/> only the <see cref="Emote.Id"/> will be populated.
/// Use <see cref="IGuild.GetEmoteAsync"/> to get the emoji.
/// </remarks>
public IEmote Emoji { get; set; }
/// <inheritdoc/>
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
/// <summary>
/// Initializes a new instance of <see cref="WelcomeScreenChannelProperties"/>.
/// </summary>
/// <param name="id">Id if a channel.</param>
/// <param name="description">Description for the channel in the welcome screen.</param>
/// <param name="emoji">The emoji for the channel in the welcome screen.</param>
public WelcomeScreenChannelProperties(ulong id, string description, IEmote emoji = null)
{
Id = id;
Description = description;
Emoji = emoji;
}
/// <summary>
/// Initializes a new instance of <see cref="WelcomeScreenChannelProperties"/>.
/// </summary>
public WelcomeScreenChannelProperties() { }
/// <summary>
/// Initializes a new instance of <see cref="WelcomeScreenChannelProperties"/>.
/// </summary>
/// <param name="channel">A welcome screen channel to modify.</param>
/// <returns>A new instance of <see cref="WelcomeScreenChannelProperties"/>.</returns>
public static WelcomeScreenChannelProperties FromWelcomeScreenChannel(WelcomeScreenChannel channel)
=> new (channel.Id, channel.Description, channel.Emoji);
/// Gets the value(s) of a <see cref="SelectMenuComponent"/> interaction response.
/// Gets the value(s) of a <see cref="ComponentType.SelectMenu"/> interaction response. <see langword="null"/> if select type is different.
/// </summary>
IReadOnlyCollection<string> Values { get; }
/// <summary>
/// Gets the value of a <see cref="TextInputComponent"/> interaction response.
/// Gets the channels(s) of a <see cref="ComponentType.ChannelSelect"/> interaction response. <see langword="null"/> if select type is different.
/// </summary>
IReadOnlyCollection<IChannel> Channels { get; }
/// <summary>
/// Gets the user(s) of a <see cref="ComponentType.UserSelect"/> or <see cref="ComponentType.MentionableSelect"/> interaction response. <see langword="null"/> if select type is different.
/// </summary>
IReadOnlyCollection<IUser> Users { get; }
/// <summary>
/// Gets the roles(s) of a <see cref="ComponentType.RoleSelect"/> or <see cref="ComponentType.MentionableSelect"/> interaction response. <see langword="null"/> if select type is different.
/// </summary>
IReadOnlyCollection<IRole> Roles { get; }
/// <summary>
/// Gets the guild member(s) of a <see cref="ComponentType.UserSelect"/> or <see cref="ComponentType.MentionableSelect"/> interaction response. <see langword="null"/> if type select is different.
/// </summary>
IReadOnlyCollection<IGuildUser> Members { get; }
/// <summary>
/// Gets the value of a <see cref="ComponentType.TextInput"/> interaction response.
public override IReadOnlyCollection<CommandParameterInfo> Parameters { get; }
public override IReadOnlyList<CommandParameterInfo> Parameters { get; }
/// <inheritdoc/>
public override bool SupportsWildCards => false;
@@ -41,9 +41,12 @@ namespace Discord.Interactions
if (context.Interaction is not IAutocompleteInteraction)
return ExecuteResult.FromError(InteractionCommandError.ParseFailed, $"Provided {nameof(IInteractionContext)} doesn't belong to a Autocomplete Interaction");
var captureCount = wildcardCaptures?.Count() ?? 0;
if (context.Interaction is not IComponentInteraction messageComponent)
return ExecuteResult.FromError(InteractionCommandError.ParseFailed, $"Provided {nameof(IInteractionContext)} doesn't belong to a Component Command Interaction");
var captures = (context as IRouteMatchContainer)?.SegmentMatches?.ToList();
var captureCount = captures?.Count() ?? 0;
try
{
var args = new object[paramCount];
var data = (context.Interaction as IComponentInteraction).Data;
var args = new object[Parameters.Count];
for (var i = 0; i < paramCount; i++)
for(var i = 0; i < Parameters.Count; i++)
{
var parameter = Parameters.ElementAt(i);
var parameter = Parameters[i];
var isCapture = i < captureCount;
if (isCapture ^ parameter.IsRouteSegmentParameter)
return await InvokeEventAndReturn(context, ExecuteResult.FromError(InteractionCommandError.BadArgs, "Argument type and parameter type didn't match (Wild Card capture/Component value)")).ConfigureAwait(false);
var readResult = isCapture ? await parameter.TypeReader.ReadAsync(context, wildcardCaptures.ElementAt(i), services).ConfigureAwait(false) :
var readResult = isCapture ? await parameter.TypeReader.ReadAsync(context, captures[i].Value, services).ConfigureAwait(false) :
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.