Exemplo n.º 1
0
        public async Task honkCount([Remainder] string msg = "")
        {
            var  db   = new BotBaseContext();
            Honk honk = new Honk();

            if (Regex.IsMatch(msg, @"[0-9]+"))
            {
                var id = Convert.ToUInt64(Regex.Match(msg, @"[0-9]+").Value);
                honk = db.Honk.AsQueryable().Where(user => user.UserId == id).FirstOrDefault();
            }
            else
            {
                honk = db.Honk.AsQueryable().Where(user => user.UserId == Context.Message.Author.Id).FirstOrDefault();
            }

            if (honk != null)
            {
                await ReplyAsync($"Honked {honk.Count} times!");
            }
            else
            {
                await ReplyAsync("This user has never honked! For shame!");
            }
        }
Exemplo n.º 2
0
 public void OnHonk(string noise, string fun) =>
 Honk?.Invoke(this, $"Fin{noise} {fun}");