private async Task DoSpeakAsync(CommandContext ctx, int randomMinutesFrom = 0, int randomMinutesTo = 0) { while (true) { Quote Quote = _quotesManager.GetRandomQuote(); if (Quote == null) { return; } var embed = DoGet(ctx, Quote); if (embed != null) { await ctx.Channel.SendMessageAsync(embed : embed); } var waitTime = SetWaitTime(randomMinutesFrom, randomMinutesTo); await Task.Delay(waitTime, _cancellationTokenSource.Token); } ; }
public async Task Get(CommandContext ctx, int ID = 0) { if (!_util.GuildChannelFilterIsValid(ctx)) { return; } await ctx.TriggerTypingAsync(); Quote Quote; if (ID <= 0) { Quote = _quotesManager.GetRandomQuote(); } else { Quote = _quotesManager.GetQuote(ID); } if (Quote != null) { var embed = DoGet(ctx, Quote); if (embed != null) { await ctx.RespondAsync(embed : embed); } else { var emoji = DiscordEmoji.FromName(ctx.Client, ":thumbsdown:"); await ctx.RespondAsync($"{emoji}"); } } else { var emoji = DiscordEmoji.FromName(ctx.Client, ":thumbsdown:"); await ctx.RespondAsync($"{emoji}"); } }