private void ScheduleEventsForRole(CommandContext context, DiscordChannel announcementChannel, IBotAccessProvider provider, GuildEvent selectedEvent, Instant eventDateTime, DiscordRole role)
        {
            Duration eventScheduleDuration = eventDateTime - this.clock.GetCurrentInstant();
            string   scheduledJobId        = BackgroundJob.Schedule <EventService>(
                eventService =>
                eventService.SendEmbedWithMessageToChannelAsUser(
                    context.Guild.Id,
                    context.Member.Id,
                    announcementChannel.Id,
                    $"{(role == null ? "@everyone" : role.Mention)}, this event is starting now!",
                    selectedEvent.EventName,
                    selectedEvent.EventDesc),
                eventScheduleDuration.ToTimeSpan());

            provider.AddGuildBackgroundJob(scheduledJobId, context.Guild.Id, $"{selectedEvent.EventName} - Announcement", eventDateTime, GuildJobType.SCHEDULED_EVENT);

            scheduledJobId = BackgroundJob.Schedule <EventService>(
                eventService
                => eventService.SendEmbedWithMessageToChannelAsUser(
                    context.Guild.Id,
                    context.Member.Id,
                    announcementChannel.Id,
                    $"{(role == null ? "@everyone" : role.Mention)}, this event is starting in 10 minutes!",
                    selectedEvent.EventName,
                    selectedEvent.EventDesc
                    ),
                (eventScheduleDuration - Duration.FromMinutes(10)).ToTimeSpan());

            provider.AddGuildBackgroundJob(scheduledJobId, context.Guild.Id, $"{selectedEvent.EventName} - 10 Min Announcement", eventDateTime - Duration.FromMinutes(10), GuildJobType.SCHEDULED_EVENT);
        }
        public async Task TempMuteMemberAsync(CommandContext context,
                                              [Description("The member to mute")]
                                              DiscordMember member,
                                              [Description("Duration to mute the member for (must be quoted if there are any spaces, however it should work with colloquial language)")]
                                              string durationOfMute,
                                              [RemainingText]
                                              [Description("The reason for the mute")]
                                              string reason = null)
        {
            DateTimeV2ModelResult durationResult = DateTimeRecognizer
                                                   .RecognizeDateTime(durationOfMute, culture: Culture.English)
                                                   .Select(model => model.ToDateTimeV2ModelResult())
                                                   .Where(result => result.TypeName is DateTimeV2Type.Duration)
                                                   .FirstOrDefault();

            if (durationResult == null)
            {
                await context.RespondAsync("There was an error parsing the duration");

                return;
            }

            Duration duration       = (Duration)durationResult.Values.FirstOrDefault().Value;
            string   durationString = Period.FromSeconds((long)duration.TotalSeconds).AsHumanReadableString();

            DiscordRole mutedRole = await GetOrCreateMutedRole(context);

            DiscordEmbedBuilder successEmbed = new DiscordEmbedBuilder()
                                               .WithTitle($"You have been temporarily muted in {context.Guild.Name}!")
                                               .AddField("Duration", durationString);

            if (reason != null)
            {
                successEmbed.AddField("Reason:", reason);
            }

            using IBotAccessProvider provider = this.providerBuilder.Build();

            DiscordChannel logChannel = await SendModerationEmbedAndGetLogChannel(successEmbed, member, context.Member, context.Guild, provider);

            await member.GrantRoleAsync(mutedRole, reason);

            provider.AddModerationAuditRecord(context.Guild.Id, context.User.Id, member.Id, ModerationActionType.MUTE, reason);
            await context.Message.CreateReactionAsync(DiscordEmoji.FromName(context.Client, ":white_check_mark:"));

            if (logChannel == null)
            {
                return;
            }

            successEmbed = new DiscordEmbedBuilder()
                           .WithTitle($"{member.DisplayName} was muted")
                           .AddField("Moderator", context.Member.DisplayName)
                           .AddField("Duration", durationString)
                           .WithFooter($"{this.clock.GetCurrentInstant():g}");

            if (reason != null)
            {
                successEmbed.AddField("Reason", reason);
            }

            await logChannel.SendMessageAsync(embed : successEmbed);

            string jobId = BackgroundJob.Schedule <ModerationService>(service => service.RemoveRole(context.Guild.Id, member.Id, mutedRole.Id), duration.ToTimeSpan());

            provider.AddGuildBackgroundJob(jobId, context.Guild.Id, $"Unmute - {member.DisplayName}", this.clock.GetCurrentInstant() + duration, GuildJobType.TEMP_MUTE);
        }