コード例 #1
0
        public async Task Kiss(IGuildUser user)
        {
            Bird[] final = (Bird[])JSONhandler.GetElement(JsonFile.kiss);

            if (user.Id == Context.User.Id)
            {
                await Context.Channel.SendMessageAsync("You can't kiss yourself!");

                return;
            }
            else if (user.Id == 665514955985911818)
            {
                await Context.Channel.SendMessageAsync("Don't kiss me! *Because I'm shy*");

                return;
            }
            else if (user.IsBot == true)
            {
                await Context.Channel.SendMessageAsync("You can't kiss bot!");

                return;
            }

            EmbedBuilder build  = new EmbedBuilder();
            Random       rand   = new Random();
            int          choose = rand.Next(1, final.Length);

            build.WithTitle(Context.User.ToString() + " is kissing " + user.ToString() + "!")
            .WithImageUrl(final[choose].link);

            await Context.Channel.SendMessageAsync("", false, build.Build());
        }
コード例 #2
0
        public async Task Bite(IGuildUser user)
        {
            Bird[] final = (Bird[])JSONhandler.GetElement(JsonFile.bite);

            if (user.Id == Context.User.Id)
            {
                await Context.Channel.SendMessageAsync("You can't bite yourself! That hurts!");

                return;
            }
            else if (user.Id == 665514955985911818)
            {
                await Context.Channel.SendMessageAsync("Don't bite me you monster!!");

                return;
            }
            else if (user.IsBot == true)
            {
                await Context.Channel.SendMessageAsync("You can't bite bot!");

                return;
            }

            EmbedBuilder build  = new EmbedBuilder();
            Random       rand   = new Random();
            int          choose = rand.Next(1, final.Length);

            build.WithTitle(Context.User.ToString() + " is biting " + user.ToString() + "!")
            .WithImageUrl(final[choose].link);

            await Context.Channel.SendMessageAsync("", false, build.Build());
        }
コード例 #3
0
        public async Task MainAsync()
        {
            Config x = (Config)JSONhandler.GetElement(JsonFile.config, 0);

            await _client.LoginAsync(TokenType.Bot, x.token);

            await _client.StartAsync();

            await Task.Delay(-1);
        }
コード例 #4
0
        public async Task EightBall([Remainder] string text)
        {
            try
            {
                EightBall[] final = (EightBall[])JSONhandler.GetElement(JsonFile.EightBall);

                var    plainTextBytes = System.Text.Encoding.UTF8.GetBytes(text);
                string converted      = System.Convert.ToBase64String(plainTextBytes);
                byte[] LogoDataBy     = Encoding.ASCII.GetBytes(converted);
                int    seed           = 0;
                foreach (byte byt in LogoDataBy)
                {
                    seed += byt;
                }

                Random x = new Random(seed);

                await Context.Channel.SendMessageAsync(final[x.Next(1, final.Length)].text);
            }
            catch (HttpRequestException)
            {
                await Context.Channel.SendMessageAsync("Can't connect to API. Please, contact with author.");
            }
        }