Exemple #1
0
        public async Task Roll([Remainder] string rollText = null)
        {
            rollText = RollCommands.TextOrDefault(rollText);

            List <List <RollResult> > result = RollCommands.BuildAndRoll(rollText);

            EmbedBuilder builder = RollFormater.GenerateDiscordBuilder(result, Context);

            // Post the embed to the channel
            await Context.Channel.SendMessageAsync(string.Empty, embed : builder.Build());

            // Delete the requesting message
            // await Context.Message.DeleteAsync();
        }
Exemple #2
0
        public async Task Death()
        {
            List <List <RollResult> > result = RollCommands.BuildAndRoll("1d20");

            // Create a builder to construct the output.
            EmbedBuilder builder = new EmbedBuilder();

            // Set author and image
            builder.WithAuthor("Deaths Door", "https://cdn.pixabay.com/photo/2014/03/25/15/17/cross-296395_1280.png");

            // Set outline to be red.
            builder.WithColor(Color.DarkerGrey);

            int total = result.Sum(x => x.Sum(y => y.Result));

            string status = total >= 10 ? "Success" : "Failure";

            // Set the description to show results.
            builder.WithDescription($"{Context.User.Mention}: {total} = {status}");

            await Context.Channel.SendMessageAsync(string.Empty, embed : builder.Build());
        }