1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-19 16:33:36 +03:00

Add long support

This commit is contained in:
Macintxsh 2023-10-02 20:53:54 +03:00
parent 24f59e8785
commit cbf263622d
Signed by: mctaylors
GPG key ID: 361D326747B61E65

View file

@ -242,9 +242,9 @@ public class ToolsCommandGroup : CommandGroup
[Description("Generates a random number")]
[UsedImplicitly]
public async Task<Result> ExecuteRandomAsync(
[Description("First number")] int first,
[Description("First number")] long first,
[Description("Second number (Default: 0)")]
int second = 0)
long second = 0)
{
if (!_context.TryGetContextIDs(out var guildId, out _, out var userId))
{
@ -263,12 +263,12 @@ public class ToolsCommandGroup : CommandGroup
return await SendRandomNumberAsync(first, second, user, CancellationToken);
}
private async Task<Result> SendRandomNumberAsync(int first, int second, IUser user, CancellationToken ct)
private async Task<Result> SendRandomNumberAsync(long first, long second, IUser user, CancellationToken ct)
{
var min = Math.Min(first, second);
var max = Math.Max(first, second);
var i = Random.Shared.Next(min, max + 1);
var i = Random.Shared.NextInt64(min, max + 1);
var description = new StringBuilder().Append("# ").AppendLine(i.ToString())
.Append("- ").AppendLine(string.Format(Messages.RandomMin, Markdown.InlineCode(min.ToString())))