[Feature] Default thread ratelimit in guild text channels (#2622)

* initial commit

* mocked bruh
This commit is contained in:
Misha133
2023-03-31 14:22:00 +03:00
committed by GitHub
parent 529fe3d969
commit f9c8530a89
10 changed files with 41 additions and 18 deletions

View File

@@ -9,9 +9,6 @@ internal class ModifyForumChannelParams : ModifyTextChannelParams
[JsonProperty("available_tags")]
public Optional<ModifyForumTagParams[]> Tags { get; set; }
[JsonProperty("default_thread_rate_limit_per_user")]
public Optional<int> DefaultSlowModeInterval { get; set; }
[JsonProperty("rate_limit_per_user")]
public Optional<int> ThreadCreationInterval { get; set; }

View File

@@ -7,9 +7,14 @@ namespace Discord.API.Rest
{
[JsonProperty("topic")]
public Optional<string> Topic { get; set; }
[JsonProperty("nsfw")]
public Optional<bool> IsNsfw { get; set; }
[JsonProperty("rate_limit_per_user")]
public Optional<int> SlowModeInterval { get; set; }
[JsonProperty("default_thread_rate_limit_per_user")]
public Optional<int> DefaultSlowModeInterval { get; set; }
}
}

View File

@@ -65,6 +65,7 @@ namespace Discord.Rest
Deny = overwrite.Permissions.DenyValue.ToString()
}).ToArray()
: Optional.Create<API.Overwrite[]>(),
DefaultSlowModeInterval = args.DefaultSlowModeInterval
};
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
}

View File

@@ -27,6 +27,8 @@ namespace Discord.Rest
public bool IsNsfw { get; private set; }
/// <inheritdoc />
public ThreadArchiveDuration DefaultArchiveDuration { get; private set; }
/// <inheritdoc />
public int DefaultSlowModeInterval { get; private set; }
internal RestTextChannel(BaseDiscordClient discord, IGuild guild, ulong id)
: base(discord, guild, id)
@@ -52,6 +54,8 @@ namespace Discord.Rest
DefaultArchiveDuration = model.AutoArchiveDuration.Value;
else
DefaultArchiveDuration = ThreadArchiveDuration.OneDay;
DefaultSlowModeInterval = model.ThreadRateLimitPerUser.GetValueOrDefault(0);
// basic value at channel creation. Shouldn't be called since guild text channels always have this property
}