Exemple #1
0
        public async Task Iq(IUser user = null)
        {
            if (user == null)
            {
                user = Context.User;
            }

            ulong  id        = user.Id;
            int    month     = DateTime.UtcNow.Month;
            string plaintext = "Who?" + id.ToString() + month.ToString() + "Tao";

            byte[] bytes  = Encoding.UTF8.GetBytes(plaintext);
            byte[] hash   = new MD5CryptoServiceProvider().ComputeHash(bytes);
            uint   random = BitConverter.ToUInt32(hash.Take(4).ToArray());
            float  x      = random / (uint.MaxValue / 10f);
            float  y      = 1 + MathF.Tan((x * MathF.PI) / 20);
            int    iq     = (int)(y * 75);

            await ReplyAsync($"{user.Username}'s IQ is {iq}");
        }