Ejemplo n.º 1
0
        private IEnumerable <ResponseMessage> DeleteSchedulesHandler(IncomingMessage message, string matchedHandle)
        {
            if (!_adminPlugin.AuthenticateUser(message.UserId))
            {
                yield return(message.ReplyToChannel($"Sorry {message.Username}, only admins can use this function."));

                yield break;
            }

            var schedules = _schedulePlugin.ListAllSchedules();

            _schedulePlugin.DeleteSchedules(schedules);

            yield return(message.ReplyToChannel("All schedules deleted"));
        }
Ejemplo n.º 2
0
        private async IAsyncEnumerable <ResponseMessage> DeleteSchedulesHandler(IncomingMessage message, IValidHandle matchedHandle)
        {
            if (!_adminPlugin.AuthenticateUser(message.UserId))
            {
                yield return(await Task.FromResult(message.ReplyToChannel($"Sorry {message.Username}, only admins can use this function.")));

                yield break;
            }

            var schedules = _schedulePlugin.ListAllSchedules();

            _schedulePlugin.DeleteSchedules(schedules.Select(x => x.Guid).ToArray());

            yield return(message.ReplyToChannel("All schedules deleted"));
        }