コード例 #1
0
        public async Task NextLaunchAsync(CommandContext ctx)
        {
            await ctx.TriggerTypingAsync();

            var launchData = await _cacheService.GetAsync <LaunchInfo>(CacheContentType.NextLaunch);

            var embed = _launchInfoEmbedGenerator.Build(launchData, ctx.Guild.Id, true);

            var sentMessage = await ctx.RespondAsync(string.Empty, false, embed);

            await sentMessage.CreateReactionAsync(DiscordEmoji.FromName(Bot.Client, ":regional_indicator_s:"));

            await _launchNotificationsService.AddMessageToSubscribe(ctx.Channel, sentMessage);
        }
コード例 #2
0
        private async Task SendLaunchNotificationToUserAsync(DiscordMember member, LaunchInfo nextLaunch)
        {
            var launchInfoEmbed = _launchInfoEmbedGenerator.Build(nextLaunch, null, false);
            await member.SendMessageAsync($"**{MinutesToLaunchToNotify} minutes to launch!**", false, launchInfoEmbed);

            if (nextLaunch.Links.Webcast != null)
            {
                await member.SendMessageAsync($"Watch launch at stream: {nextLaunch.Links.Webcast}");
            }

            await member.SendMessageAsync("*You received this message because we noticed that you subscribed this launch. Remember that " +
                                          "subscription is one-time and you have to do it again if you want to receive similar notification " +
                                          "about next launch in the future.*");
        }