public void CallMenu(object sender, XQEventArgs e) { api = e.XQAPI; MainWindow main = new MainWindow(); main.Show(); }
public static int XQ_SetUp() { if (Event_CallMenu != null) { var args = new XQEventArgs(xqapi); Event_CallMenu(typeof(XQEvent), args); } return(0); }
public static int XQ_DestroyPlugin() { if (Event_AppDisableHandler != null) { var args = new XQEventArgs(xqapi); Event_AppDisableHandler(typeof(XQEvent), args); } return(0); }
public static int Menu() { if (EventContainer.Container.IsRegistered <IXQCallMenu>()) { var args = new XQEventArgs(Common.xQAPI); _Event.Event_CallMenu(typeof(_Event), args); //_Event.Event_CallMenu += EventContainer.Container.Resolve<IXQCallMenu>().CallMenu; } return(0); }
public void AppEnable(object sender, XQEventArgs e) { try { e.XQAPI.Log("MoonSliver正在加载敏感词库..."); MoonSliver.LoadDic(e.XQAPI.AppDirectory); MoonSliver.LoadSetting(e.XQAPI.AppDirectory); e.XQAPI.Log($"MoonSliver成功加载了{MoonSliver.KeyWordsDic.Count}个词库文件"); } catch (Exception ex) { e.XQAPI.Info("[错误]", "MoonSliver加载词库失败..."); } }
public static void enable(object sender, XQEventArgs e) { string configPath = Path.Combine(XQAPI.AppDir, "config.json"); if (!File.Exists(@configPath)) { WriteJson(@configPath); } XQAPI.OutPutLog("[fortune-运势] 项目地址 https://github.com/Yiwen-Chan/fortune"); XQAPI.OutPutLog("[fortune-运势] 配置目录 " + configPath); XQAPI.OutPutLog("[fortune-运势] 特别感谢 fz6m https://github.com/fz6m/nonebot-plugin/tree/master/CQVortune"); XQAPI.OutPutLog("[fortune-运势] 特别感谢 Lostdegree https://github.com/Lostdegree/Portune"); XQAPI.OutPutLog("[fortune-运势] 想自定义运势背景并共享可加QQ群 1048452984 "); }
public void Process(XQEventArgs _e) { // var e = new GroupMsgEventArgs(_e); if (e.Message == "我醒了") { if (DateTime.Now.Hour < 8) { e.SendMsg(XQCode.At(e.FromQQ) + "你醒啦!"); } if (8 <= DateTime.Now.Hour && DateTime.Now.Hour <= 10) { e.SendMsg(XQCode.At(e.FromQQ) + "快起床!"); } if (DateTime.Now.Hour > 10) { e.SendMsg(XQCode.At(e.FromQQ) + "懒虫!"); } } }
public static int Event(string robotQQ, int eventType, int extraType, string from, string fromQQ, string targetQQ, string content, string index, string msgid, string udpmsg, string unix, int p) { try { var oargs = new OriginArgs(robotQQ, eventType, extraType, from, fromQQ, targetQQ, content, index, msgid, udpmsg, unix, p); var maineventarg = new XQEventArgs(new SDK.Models.XQAPI() { RobotQQ = robotQQ }, oargs); Events.FindAll(e => (int)e.EventType == eventType)?.ForEach(eve => { eve.Process(maineventarg); }); return(1); } catch (Exception ex) { _Main.Log(ex.ToString()); return(1); } }
public static int XQ_Event(string robotQQ, int eventType, int extraType, string from, string fromQQ, string targetQQ, string content, string index, string msgid, string udpmsg, string unix, int p) { try { if (eventType == (int)XQEventType.Group) { if (Event_GroupMsgHandler != null)//群聊消息 { XQAppGroupMsgEventArgs args = new XQAppGroupMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, fromQQ, content, index, msgid, xqapi); Event_GroupMsgHandler(typeof(XQEvent), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.Friend)//好友消息 { if (Event_PrivateMsgHandler != null) { XQAppPrivateMsgEventArgs args = new XQAppPrivateMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, content, index, msgid, xqapi); Event_PrivateMsgHandler(typeof(XQEvent), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.PluginEnable)//插件启动 { if (Event_AppEnableHandler != null) { var args = new XQEventArgs(xqapi); Event_AppEnableHandler(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.AddGroup || eventType == (int)XQEventType.InvitedToGroup)//群申请/邀请事件AddGroup { if (Event_AddGroupHandler != null) { var args = new XQAddGroupEventArgs(xqapi, robotQQ, eventType, fromQQ, from, udpmsg); Event_AddGroupHandler(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.AddFriend)//加好友事件 { if (Event_AddFriendHandler != null) { var args = new XQAddFriendEventArgs(xqapi, robotQQ, eventType, fromQQ); Event_AddFriendHandler(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.BanSpeak)//被禁言 { if (Event_BanSpeak != null) { var args = new XQBanSpeakEventArgs(xqapi, robotQQ, eventType, fromQQ, targetQQ, from); Event_BanSpeak(typeof(XQEvent), args); } } if (eventType == (int)XQEventType.AddFriend)//被解除禁言 { if (Event_UnBanSpeak != null) { var args = new XQUnBanSpeakEventArgs(xqapi, robotQQ, eventType, fromQQ, targetQQ, from); Event_UnBanSpeak(typeof(XQEvent), args); } } return(1); } catch (Exception ex) { xqapi.Error(ex.Message); return(1); } }
public static int Event(string robotQQ, int eventType, int extraType, string from, string fromQQ, string targetQQ, string content, string index, string msgid, string udpmsg, string unix, int p) { try { if (eventType == (int)XQEventType.Group) { if (Event_GroupMsgHandler != null)//群聊消息 { XQAppGroupMsgEventArgs args = new XQAppGroupMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, fromQQ, content, index, msgid, Common.xQAPI); Event_GroupMsgHandler(typeof(_Event), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.Friend)//好友消息 { if (Event_PrivateMsgHandler != null) { XQAppPrivateMsgEventArgs args = new XQAppPrivateMsgEventArgs(robotQQ, (int)eventType, (int)extraType, from, content, index, msgid, Common.xQAPI); Event_PrivateMsgHandler(typeof(_Event), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.GroupTmp)//群临时消息 { if (Event_PrivateMsgHandler != null) { XQAppPrivateMsgEventArgs args = new XQAppPrivateMsgEventArgs(robotQQ, (int)eventType, (int)extraType, fromQQ, content, index, msgid, Common.xQAPI); args.FromGroup = new XQ.Net.SDK.Models.XQGroup(from, Common.xQAPI); Event_PrivateMsgHandler(typeof(_Event), args); return(args.Handler ? 2 : 1); //阻塞返回2,继续返回1 } } if (eventType == (int)XQEventType.PluginEnable)//插件启动 { if (Event_AppEnableHandler != null) { var args = new XQEventArgs(Common.xQAPI); Event_AppEnableHandler(typeof(_Event), args); } } if (eventType == (int)XQEventType.AddGroup || eventType == (int)XQEventType.InvitedToGroup || eventType == (int)XQEventType.SomeoneInvitedToGroup || eventType == (int)XQEventType.AllowedToGroup) //群申请/邀请事件AddGroup { if (Event_AddGroupHandler != null) { var args = new XQAddGroupEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ, from, udpmsg); Event_AddGroupHandler(typeof(_Event), args); } } if (eventType == (int)XQEventType.AddFriend)//加好友事件 { if (Event_AddFriendHandler != null) { var args = new XQAddFriendEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ); Event_AddFriendHandler(typeof(_Event), args); } } if (eventType == (int)XQEventType.BanSpeak)//被禁言 { if (Event_BanSpeak != null) { var args = new XQBanSpeakEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ, targetQQ, from); Event_BanSpeak(typeof(_Event), args); } } if (eventType == (int)XQEventType.UnBanSpeak)//被解除禁言 { if (Event_UnBanSpeak != null) { var args = new XQUnBanSpeakEventArgs(Common.xQAPI, robotQQ, eventType, fromQQ, targetQQ, from); Event_UnBanSpeak(typeof(_Event), args); } } return(1); } catch (Exception ex) { Common.Log(ex.ToString()); return(1); } }