public async Task EightBall([Remainder][Summary("The question")] string question) { await Context.Message.AddReactionAsync(new Emoji("🎱")); DaveRNG random = new DaveRNG(); string answer = (_config.EightBallResponses.Length > 0)? _config.EightBallResponses[random.Next(_config.EightBallResponses.Length)]: DefaultEightBallResponses[random.Next(DefaultEightBallResponses.Length)]; await ReplyAsync("", false, new EmbedBuilder() .AddField($":question: {StringResourceHandler.GetTextStatic("Fun", "8ball_question")}", question) .AddField($":8ball: {StringResourceHandler.GetTextStatic("Fun", "8ball_answer")}", answer) .WithColor(Color.Blue) .Build()); }
public async Task Choose([Remainder][Summary("Options (seperate with `;`)")] string options) { await Context.Message.AddReactionAsync(new Emoji("🤔")); var random = new DaveRNG(); var optionsIndiv = options.Split(';'); var choice = optionsIndiv[random.Next(optionsIndiv.Length)]; await ReplyAsync("", false, new EmbedBuilder() .AddField(":thinking:", choice) .WithColor(Color.Blue) .Build()); }
private async void NextPlayingStatus(object state) { try { if (_config.RotatePlayingStatuses && (_config.PlayingStatuses.Length > 0)) { await _client.SetGameAsync(_config.PlayingStatuses[_rng.Next(_config.PlayingStatuses.Length - 1)]); } }catch (Exception e) { LogManager.GetCurrentClassLogger().Error($"Couldn't update playing status: {e.Message}"); } }
public async Task Ping() { await Context.Message.AddReactionAsync(new Emoji("🏓")); var pleasewait = Context.Channel.EnterTypingState(); var pingwaitmsg = StringResourceHandler.GetTextStatic("Utils", "ping_wait"); var msg = await Context.Channel.SendMessageAsync("🏓 " + pingwaitmsg).ConfigureAwait(false); var sw = Stopwatch.StartNew(); await msg.DeleteAsync(); sw.Stop(); var random = new DaveRNG(); var subtitleText = StringResourceHandler.GetTextStatic("Utils", "ping_subtitle" + random.Next(1, 5)); var footerText = StringResourceHandler.GetTextStatic("Utils", "ping_footer1"); if (sw.ElapsedMilliseconds > 150) { footerText = StringResourceHandler.GetTextStatic("Utils", "ping_footer2"); } if (sw.ElapsedMilliseconds > 300) { footerText = StringResourceHandler.GetTextStatic("Utils", "ping_footer3"); } if (sw.ElapsedMilliseconds > 800) { footerText = StringResourceHandler.GetTextStatic("Utils", "ping_footer4"); } if (sw.ElapsedMilliseconds > 3000) { footerText = StringResourceHandler.GetTextStatic("Utils", "ping_footer5"); } pleasewait.Dispose(); await ReplyAsync(Context.User.Mention, false, new EmbedBuilder() .WithTitle("🏓 " + StringResourceHandler.GetTextStatic("Utils", "ping_title")) .WithDescription(subtitleText + '\n' + StringResourceHandler.GetTextStatic("Utils", "ping_pingtime", sw.ElapsedMilliseconds, defaultPingLocations[random.Next(defaultPingLocations.Length)])) .WithFooter(footerText) .WithColor(Color.Blue) .Build()); }