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:
parent
24f59e8785
commit
cbf263622d
1 changed files with 4 additions and 4 deletions
|
@ -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())))
|
||||
|
|
Loading…
Add table
Reference in a new issue