mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-30 11:09:54 +03:00
Limit string argument length to avoid "embed description too long" errors (#174)
This PR fixes an error that would appear if a string that's way too long
was passed as a command argument by limiting the string's length

This commit is contained in:
parent
cf7007f269
commit
0ba357e4c7
5 changed files with 19 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
using JetBrains.Annotations;
|
||||
using Octobot.Data;
|
||||
|
@ -72,7 +73,8 @@ public class BanCommandGroup : CommandGroup
|
|||
[UsedImplicitly]
|
||||
public async Task<Result> ExecuteBanAsync(
|
||||
[Description("User to ban")] IUser target,
|
||||
[Description("Ban reason")] string reason,
|
||||
[Description("Ban reason")] [MaxLength(256)]
|
||||
string reason,
|
||||
[Description("Ban duration")] TimeSpan? duration = null)
|
||||
{
|
||||
if (!_context.TryGetContextIDs(out var guildId, out var channelId, out var executorId))
|
||||
|
@ -216,7 +218,8 @@ public class BanCommandGroup : CommandGroup
|
|||
[UsedImplicitly]
|
||||
public async Task<Result> ExecuteUnban(
|
||||
[Description("User to unban")] IUser target,
|
||||
[Description("Unban reason")] string reason)
|
||||
[Description("Unban reason")] [MaxLength(256)]
|
||||
string reason)
|
||||
{
|
||||
if (!_context.TryGetContextIDs(out var guildId, out var channelId, out var executorId))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue