Adding default diceRecipe
This commit is contained in:
parent
01d504c077
commit
345304537a
@ -23,35 +23,42 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string diceRecipe = Strings.Join(args, " ");
|
string diceRecipe = null;
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
if (args.Length > 1)
|
||||||
var embed = new EmbedBuilder();
|
diceRecipe = Strings.Join(args, " ");
|
||||||
|
else
|
||||||
|
diceRecipe = "1d20";
|
||||||
|
|
||||||
RollResult rollResult = Roller.Roll(diceRecipe);
|
var sb = new StringBuilder();
|
||||||
|
var embed = new EmbedBuilder();
|
||||||
|
|
||||||
embed.WithColor(new Color(255, 255,0));
|
RollResult rollResult = Roller.Roll(diceRecipe);
|
||||||
// embed.Title = $"Dice Roll";
|
|
||||||
sb.AppendLine($"{Context.User.Mention} :game_die:");
|
|
||||||
sb.AppendLine($"Result: {diceRecipe} ({DiceOutput(rollResult)})");
|
|
||||||
sb.AppendLine($"Total: {rollResult.Value}");
|
|
||||||
|
|
||||||
/*
|
embed.WithColor(new Color(255, 255, 0));
|
||||||
* Add the string to the Embed
|
// embed.Title = $"Dice Roll";
|
||||||
*/
|
sb.AppendLine($"{Context.User.Mention} :game_die:");
|
||||||
embed.Description = sb.ToString();
|
sb.AppendLine($"Result: {diceRecipe} ({DiceOutput(rollResult)})");
|
||||||
|
sb.AppendLine($"Total: {rollResult.Value}");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reply with the Embed created above
|
* Add the string to the Embed
|
||||||
*/
|
*/
|
||||||
await ReplyAsync(null, false, embed.Build());
|
embed.Description = sb.ToString();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reply with the Embed created above
|
||||||
|
*/
|
||||||
|
await ReplyAsync(null, false, embed.Build());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error($"{MethodBase.GetCurrentMethod().ReflectedType.FullName}: Exception [{ex}] thrown, <[{ex.Message}]>.");
|
_logger.Error(
|
||||||
|
$"{MethodBase.GetCurrentMethod().ReflectedType.FullName}: Exception [{ex}] thrown, <[{ex.Message}]>.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string DiceOutput(RollResult rollResult)
|
|
||||||
|
private string DiceOutput(RollResult rollResult)
|
||||||
{
|
{
|
||||||
if (rollResult.RollRoot == null) return "";
|
if (rollResult.RollRoot == null) return "";
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@ -104,7 +111,7 @@ namespace ChaosBot.Discord.Modules.User
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string DieFormatting(DieFlags flags, bool reverse=false)
|
private string DieFormatting(DieFlags flags, bool reverse = false)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if ((flags & (DieFlags.Critical ^ DieFlags.Success ^ DieFlags.Failure ^ DieFlags.Fumble)) != 0)
|
if ((flags & (DieFlags.Critical ^ DieFlags.Success ^ DieFlags.Failure ^ DieFlags.Fumble)) != 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user