/// Represents a class used to make timestamps in messages. see <see href="https://discord.com/developers/docs/reference#message-formatting-timestamp-styles"/>.
/// </summary>
public class TimestampTag
public readonly struct TimestampTag
{
/// <summary>
/// Gets or sets the style of the timestamp tag.
/// Gets the time for this timestamp tag.
/// </summary>
public TimestampTagStyles Style { get; set; } = TimestampTagStyles.ShortDateTime;
public DateTimeOffset Time { get; }
/// <summary>
/// Gets or sets the time for this timestamp tag.
/// Gets the style of this tag. <see langword="null"/> if none was provided.
/// </summary>
public DateTimeOffset Time { get; set; }
public TimestampTagStyles? Style { get; }
/// <summary>
/// Creates a new <see cref="TimestampTag"/> from the provided time.
/// </summary>
/// <param name="time">The time for this timestamp tag.</param>
/// <param name="style">The style for this timestamp tag.</param>
public TimestampTag(DateTimeOffset time, TimestampTagStyles? style = null)
{
Time = time;
Style = style;
}
/// <summary>
/// Converts the current timestamp tag to the string representation supported by discord.
@@ -23,11 +34,23 @@ namespace Discord
/// If the <see cref="Time"/> is null then the default 0 will be used.
/// </para>
/// </summary>
/// <remarks>
/// Will use the provided <see cref="Style"/> if provided. If this value is null, it will default to <see cref="TimestampTagStyles.ShortDateTime"/>.
/// </remarks>
/// <returns>A string that is compatible in a discord message, ex: <code><t:1625944201:f></code></returns>
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) :
public static async Task<Model> ModifyAsync(IThreadChannel channel, BaseDiscordClient client,
Action<TextChannelProperties> func,
Action<ThreadChannelProperties> func,
RequestOptions options)
{
var args = new TextChannelProperties();
var args = new ThreadChannelProperties();
func(args);
Preconditions.AtMost(args.AppliedTags.IsSpecified ? args.AppliedTags.Value.Count() : 0, 5, nameof(args.AppliedTags), "Forum post can have max 5 applied tags.");
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.