* Changed arguments to use the variables for errors * Changed name to description on error ArgumentException * Added value?.Length < 1 for Name and Description * Removed old note and added a paragraph * change para to <note type="warning"> for Valuepull/1923/head
@@ -45,7 +45,9 @@ namespace Discord | |||||
set | set | ||||
{ | { | ||||
if (value?.Length > 100) | if (value?.Length > 100) | ||||
throw new ArgumentException("Name length must be less than or equal to 32"); | |||||
throw new ArgumentException("Description length must be less than or equal to 100"); | |||||
if (value?.Length < 1) | |||||
throw new ArgumentException("Description length must at least 1 character in length"); | |||||
_description = value; | _description = value; | ||||
} | } | ||||
} | } | ||||
@@ -23,14 +23,17 @@ namespace Discord | |||||
{ | { | ||||
if(value?.Length > 100) | if(value?.Length > 100) | ||||
throw new ArgumentException("Name length must be less than or equal to 100"); | throw new ArgumentException("Name length must be less than or equal to 100"); | ||||
if (value?.Length < 1) | |||||
throw new ArgumentException("Name length must at least 1 character in length"); | |||||
_name = value; | _name = value; | ||||
} | } | ||||
} | } | ||||
// Note: discord allows strings & ints as values. how should that be handled? | |||||
// should we make this an object and then just type check it? | |||||
/// <summary> | /// <summary> | ||||
/// The value of this choice. | /// The value of this choice. | ||||
/// <note type="warning"> | |||||
/// Discord only accepts int and string as the input. | |||||
/// </note> | |||||
/// </summary> | /// </summary> | ||||
public object Value | public object Value | ||||
{ | { | ||||
@@ -296,7 +296,7 @@ namespace Discord | |||||
set | set | ||||
{ | { | ||||
if (value?.Length > SlashCommandBuilder.MaxNameLength) | if (value?.Length > SlashCommandBuilder.MaxNameLength) | ||||
throw new ArgumentException("Name length must be less than or equal to 32"); | |||||
throw new ArgumentException($"Name length must be less than or equal to {SlashCommandBuilder.MaxNameLength}"); | |||||
if (value?.Length < 1) | if (value?.Length < 1) | ||||
throw new ArgumentException("Name length must at least 1 characters in length"); | throw new ArgumentException("Name length must at least 1 characters in length"); | ||||
@@ -317,9 +317,9 @@ namespace Discord | |||||
set | set | ||||
{ | { | ||||
if (value?.Length > SlashCommandBuilder.MaxDescriptionLength) | if (value?.Length > SlashCommandBuilder.MaxDescriptionLength) | ||||
throw new ArgumentException("Description length must be less than or equal to 100"); | |||||
throw new ArgumentException($"Description length must be less than or equal to {SlashCommandBuilder.MaxDescriptionLength}"); | |||||
if (value?.Length < 1) | if (value?.Length < 1) | ||||
throw new ArgumentException("Name length must at least 1 character in length"); | |||||
throw new ArgumentException("Description length must at least 1 character in length"); | |||||
_description = value; | _description = value; | ||||
} | } | ||||