public override CoolQRouteMessage OnMessageReceived(CoolQScopeEventArgs scope) { var routeMsg = scope.RouteMessage; _routeMsg = routeMsg; try { using (_session = new Session(1000 * (60 * 2), _routeMsg.Identity, _routeMsg.UserId)) { try { NavigatableNode memberMenu, voteMenu, inputQqIdScene, handleScene; InitNode(out memberMenu, out voteMenu, out inputQqIdScene, out handleScene); var program = new NavigatableTree(mainNode, obj => { const string mainText = "· 管理员菜单:\r\n" + " 1. 群员指令\r\n" + " 2. 投票指令"; SendMessage(routeMsg.ToSource(mainText)); CoolQRouteMessage cmMain = SessionCondition("1", "2"); switch (cmMain.RawMessage) { case "1": return(new Action(memberMenuNode)); default: return(new Action()); } }); program.Root.AddChild(memberMenu); program.Root.AddChild(voteMenu); memberMenu.AddChild(inputQqIdScene); inputQqIdScene.AddChild(handleScene); program.Run(); } catch (TimeoutException e) { } } } catch (NotSupportedException) { } return(null); }
public override CommonMessageResponse Message_Received(CommonMessage messageObj) { _cm = messageObj; try { using (_session = new Session(1000 * (60 * 2), _cm.Identity, _cm.UserId)) { try { NavigatableNode memberMenu, voteMenu, inputQqIdScene, handleScene; InitNode(out memberMenu, out voteMenu, out inputQqIdScene, out handleScene); var program = new NavigatableTree(mainNode, obj => { const string mainText = "· 管理员菜单:\r\n" + " 1. 群员指令\r\n" + " 2. 投票指令"; SendMessage(new CommonMessageResponse(mainText, _cm)); CommonMessage cmMain = SessionCondition("1", "2"); switch (cmMain.Message) { case "1": return(new Action(memberMenuNode)); default: return(new Action()); } }); program.Root.AddChild(memberMenu); program.Root.AddChild(voteMenu); memberMenu.AddChild(inputQqIdScene); inputQqIdScene.AddChild(handleScene); program.Run(); } catch (TimeoutException e) { } } } catch (NotSupportedException) { } return(null); }