MrCakeSlayer GitHub 3 years ago
parent
commit
b01c2981cd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions
  1. +6
    -1
      src/Discord.Net.Core/Entities/Interactions/ApplicationCommandOptionType.cs
  2. +9
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/Slash Commands/SocketSlashCommandDataOption.cs

+ 6
- 1
src/Discord.Net.Core/Entities/Interactions/ApplicationCommandOptionType.cs View File

@@ -54,6 +54,11 @@ namespace Discord
/// <summary>
/// A <see cref="IUser"/> or <see cref="IRole"/>.
/// </summary>
Mentionable = 9
Mentionable = 9,
/// <summary>
/// A <see cref="double"/>.
/// </summary>
Number = 10
}
}

+ 9
- 1
src/Discord.Net.WebSocket/Entities/Interaction/Slash Commands/SocketSlashCommandDataOption.cs View File

@@ -96,7 +96,15 @@ namespace Discord.WebSocket
{
if (model.Value.Value is bool val)
this.Value = val;
else if (bool.TryParse(model.Value.Value.ToString(), out var res))
else if (bool.TryParse(model.Value.Value.ToString(), out bool res))
this.Value = res;
}
break;
case ApplicationCommandOptionType.Number:
{
if (model.Value.Value is int val)
this.Value = val;
else if (double.TryParse(model.Value.Value.ToString(), out double res))
this.Value = res;
}
break;


Loading…
Cancel
Save