Exemple #1
0
 public void SetContext(IQQContext context)
 {
     if (context == Context)
     {
         return;
     }
     Context     = context;
     HttpService = context.GetSerivce <IHttpService>();
     Logger      = context.GetSerivce <ILogger>();
     Session     = context.GetModule <SessionModule>();
     Store       = context.GetModule <StoreModule>();
     Account     = context.GetModule <AccountModule>();
     Config      = context.GetSerivce <IConfigurationRoot>();
 }
Exemple #2
0
        /// <summary>
        /// :warning:
        /// </summary>
        /// <param name="message"></param>
        /// <param name="exception"></param>
        /// <returns></returns>
        protected override string GetMessage(string message, Exception exception)
        {
            var userName = _context.GetModule <SessionModule>().User?.Uin;
            var prefix   = userName.IsNullOrDefault() ? string.Empty : $"[{userName}]";

            return($"{DateTime.Now:HH:mm:ss}> {prefix}{message}");
        }
Exemple #3
0
        public static bool IsOffline(this IQQContext qqClient)
        {
            var session = qqClient.GetModule <SessionModule>();

            return(session.State == SessionState.Offline);
        }