예제 #1
0
 public GameRotationService(DiscordShardedClient client, IBotConfiguration config)
 {
     _client = client;
     _config = config;
     _rng    = new DaveRNG();
     _t      = new Timer(NextPlayingStatus, null, 30000, 30000);
 }
예제 #2
0
        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());
        }
예제 #3
0
        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());
        }
예제 #4
0
        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());
        }