Ejemplo n.º 1
0
        public static Message Submit(string[] parameters, MessageEvent e)
        {
            if (System.DateTime.UtcNow.AddHours(8).DayOfWeek != System.DayOfWeek.Sunday)
            {
                return(new Message("only sunday"));
            }
            if (Creds.ensureLoggedIn(e.GetEndpoint().Item2).Result == false)
            {
                return(new Message("请重新进行/init"));
            }
            var d = new cqhttp.Cyan.Utils.Dialogue();

            d["BEGIN"] = async(c, m) => {
                await WRScraper.submitWR(
                    Creds.loggedIn[e.GetEndpoint().Item2],
                    m.GetRaw()
                    );

                await c.SendTextAsync(e.GetEndpoint(), "已提交");

                await WRScraper.updateIndex();

                return("DONE");
            };
            cqhttp.Cyan.Utils.DialoguePool.Join(e.GetEndpoint(), d);
            return(new Message("请发送周报的内容:"));
        }
Ejemplo n.º 2
0
        public async static Task <Message> Remind(string[] parameters, MessageEvent e)
        {
            await WRScraper.updateIndex();

            var unsubmitted = (
                from user in WRScraper.users.Keys
                where !WRScraper.submittedUsers.Contains(user)
                select user
                ).ToList();

            if (unsubmitted.Count > 0)
            {
                string toSend = $"仍然有{unsubmitted.Count}名铁憨憨没有交周报。他们分别是:\n";
                unsubmitted.ForEach((s) => toSend += s + ',');
                toSend  = toSend.TrimEnd(',');
                toSend += "\n清退警告⚠️";
                return(new Message(toSend));
            }
            return(new Message("终于有一次全员交齐了"));
        }
Ejemplo n.º 3
0
        public async static Task <Message> Status(string[] parameters, MessageEvent e)
        {
            await WRScraper.updateIndex();

            return(new Message($"{WRScraper.submittedUsers.Count}人已提交周报"));
        }