예제 #1
0
        public async Task EdAsync()
        {
            string path = BuildRandomVideoLinkFor(videoHandles[1]);

            var embed = new EmbedBuilder()
            {
                Url      = path,
                ImageUrl = $"http://{Constants.BaseAddress}/images/ED_img.png" + ParameterUtils.GenerateUniqueParam()
            };

            embed.WithTitle(titleText)
            .WithAuthor(Context.Client.CurrentUser)
            .WithFooter(footer => footer.Text = Constants.FooterText + Context.User.Username)
            .WithColor(Color.DarkBlue)
            .WithCurrentTimestamp();

            await ReplyAsync(embed : embed.Build());
        }
예제 #2
0
        private string BuildRandomVideoLinkFor(string videoHandle)
        {
            DirectoryInfo di = new DirectoryInfo(Path.Join(Constants.WorkingDirectory, videosDirectory, videoHandle));

            FileInfo[] files = di.GetFiles();

            if (_videoService.RollIndex < 0)
            {
                _videoService.RollIndex = files.Length - 1;
            }

            return($"http://{Constants.BaseAddress}/{videosDirectory}/{videoHandle}/{files[_videoService.RollIndex--].Name}" + ParameterUtils.GenerateUniqueParam());
        }