mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
Update /random
This commit is contained in:
parent
186eb65eb1
commit
00a7b5b5ad
5 changed files with 62 additions and 4 deletions
|
@ -654,4 +654,13 @@
|
|||
<data name="RandomOutput" xml:space="preserve">
|
||||
<value>Your random number is:</value>
|
||||
</data>
|
||||
<data name="RandomObvious" xml:space="preserve">
|
||||
<value>Isn't it obvious?</value>
|
||||
</data>
|
||||
<data name="RandomMin" xml:space="preserve">
|
||||
<value>Minimum number: {0}</value>
|
||||
</data>
|
||||
<data name="RandomMax" xml:space="preserve">
|
||||
<value>Maximum number: {0}</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -654,4 +654,13 @@
|
|||
<data name="RandomOutput" xml:space="preserve">
|
||||
<value>Ваше случайное число:</value>
|
||||
</data>
|
||||
<data name="RandomObvious" xml:space="preserve">
|
||||
<value>Разве это не очевидно?</value>
|
||||
</data>
|
||||
<data name="RandomMax" xml:space="preserve">
|
||||
<value>Максимальное число: {0}</value>
|
||||
</data>
|
||||
<data name="RandomMin" xml:space="preserve">
|
||||
<value>Минимальное число: {0}</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -654,4 +654,13 @@
|
|||
<data name="RandomOutput" xml:space="preserve">
|
||||
<value>ваше рандомное число:</value>
|
||||
</data>
|
||||
<data name="RandomObvious" xml:space="preserve">
|
||||
<value>ну чувак...</value>
|
||||
</data>
|
||||
<data name="RandomMax" xml:space="preserve">
|
||||
<value>наибольшее: {0}</value>
|
||||
</data>
|
||||
<data name="RandomMin" xml:space="preserve">
|
||||
<value>наименьшее: {0}</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -243,8 +243,8 @@ public class ToolsCommandGroup : CommandGroup
|
|||
[UsedImplicitly]
|
||||
public async Task<Result> ExecuteRandomAsync(
|
||||
[Description("Maximum number")] int max,
|
||||
[Description("Minumum number (Default: 1)")]
|
||||
int min = 1)
|
||||
[Description("Minumum number (Default: 0)")]
|
||||
int min = 0)
|
||||
{
|
||||
if (!_context.TryGetContextIDs(out var guildId, out _, out var userId))
|
||||
{
|
||||
|
@ -282,9 +282,19 @@ public class ToolsCommandGroup : CommandGroup
|
|||
|
||||
var i = Random.Shared.Next(min, max + 1);
|
||||
|
||||
var description = new StringBuilder().Append("# ").AppendLine(i.ToString())
|
||||
.Append("- ").AppendLine(string.Format(Messages.RandomMin, Markdown.InlineCode(min.ToString())))
|
||||
.Append("- ").AppendLine(string.Format(Messages.RandomMax, Markdown.InlineCode(max.ToString())));
|
||||
var embedColor = ColorsList.Blue;
|
||||
if (min == max)
|
||||
{
|
||||
description.AppendLine(Markdown.Italicise(Messages.RandomObvious));
|
||||
embedColor = ColorsList.Red;
|
||||
}
|
||||
|
||||
var embed = new EmbedBuilder().WithSmallTitle(Messages.RandomOutput, user)
|
||||
.WithDescription($"# {i}\n({min}-{max})")
|
||||
.WithColour(ColorsList.Blue)
|
||||
.WithDescription(description.ToString())
|
||||
.WithColour(embedColor)
|
||||
.Build();
|
||||
|
||||
return await _feedback.SendContextualEmbedResultAsync(embed, ct);
|
||||
|
|
21
src/Messages.Designer.cs
generated
21
src/Messages.Designer.cs
generated
|
@ -1135,5 +1135,26 @@ namespace Octobot {
|
|||
return ResourceManager.GetString("RandomOutput", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string RandomObvious
|
||||
{
|
||||
get {
|
||||
return ResourceManager.GetString("RandomObvious", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string RandomMax
|
||||
{
|
||||
get {
|
||||
return ResourceManager.GetString("RandomMax", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string RandomMin
|
||||
{
|
||||
get {
|
||||
return ResourceManager.GetString("RandomMin", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue