public void CQStartup(object sender, CQStartupEventArgs e) { CQSave.cq_start = e; CQSave.AppDirectory = e.CQApi.AppDirectory; if (!File.Exists($@"{e.CQApi.AppDirectory}装备卡\框\抽卡背景.png")) { e.CQLog.Warning("错误", "数据包未安装,插件无法运行,请仔细阅读论坛插件说明安装数据包,之后重启酷Q"); } else { if (!File.Exists($@"{e.CQApi.AppDirectory}data.db")) { Event_GroupMessage.CreateDB($@"{e.CQApi.AppDirectory}data.db"); e.CQLog.WriteLine(Native.Sdk.Cqp.Enum.CQLogLevel.Info, "已创建数据库"); } else { FileInfo info = new FileInfo($@"{e.CQApi.AppDirectory}data.db"); if (info.Length == 0) { File.Delete($@"{e.CQApi.AppDirectory}data.db"); Event_GroupMessage.CreateDB($@"{e.CQApi.AppDirectory}data.db"); e.CQLog.WriteLine(Native.Sdk.Cqp.Enum.CQLogLevel.Info, "已创建数据库"); goto jumpout; } Event_GroupMessage.CheckDB($@"{e.CQApi.AppDirectory}data.db", e); } } jumpout: cq = e; CQSave.cq_start = e; }
// 接收事件 public void CQStartup(object sender, CQStartupEventArgs e) { Thread thread; Repeaters.LoadInfo(); MessagePoster.LastOSUTime = DateTime.Now.Hour + 1; MessagePoster.workpath = Application.StartupPath; ScriptDrawer.AssetsPath = Application.StartupPath + "\\data\\image\\"; MessagePoster.logid = Guid.NewGuid().ToString(); MessagePoster.pCQ = e.CQApi; MessagePoster.TenClockLock = (DateTime.Now.Hour >= 22); VoidLifes.pCQ = e.CQApi; ArtificalA.Intelligence.ArtificalAI.DebugLog = true; AllocConsole(); Console.WriteLine("Startup:" + MessagePoster.workpath); Manager.wordcollect = new Storage("wordcollections"); Manager.LCards = new DataArrange("lockcards"); Manager.mHot = new DataArrange("mosthotmessages"); Manager.Hots = new DataArrange("messagehots"); Manager.scrBan = new DataArrange("screenmsgbanners"); UT.inits(); MessagePoster.LoadPTemples(); MessagePoster.LoadFlows(); Thread thread2 = new Thread(new ThreadStart(MessagePoster.Poster));//创建线程 thread2.Start(); thread = new Thread(new ThreadStart(Repeaters.AutoSave)); thread.Start(); Thread thread3 = new Thread(new ThreadStart(DreamYCheater.AutoFightSign));//创建线程 thread3.Start(); VoidLifes.LoadGame(); Console.WriteLine("Message poster thread works properly ."); new QQ(e.CQApi, 1361778219).SendPrivateMessage("机器人服务启动成功。"); }
public void CQStartup(object sender, CQStartupEventArgs e) { MainSave.AppDirectory = e.CQApi.AppDirectory; MainSave.CQApi = e.CQApi; MainSave.CQLog = e.CQLog; MainSave.ImageDirectory = CommonHelper.GetAppImageDirectory(); MainSave.CookiePath = Path.Combine(e.CQApi.AppDirectory, "Cookies.json"); MainSave.ConfigPath = Path.Combine(e.CQApi.AppDirectory, "Config.json"); //这里写处理逻辑 MainSave.Instances.Add(new SignMain());//这里需要将指令实例化填在这里 if (File.Exists(MainSave.ConfigPath)) { MainSave.AppConfig = AppConfig.LoadConfig(); } else { MainSave.AppConfig = new AppConfig(); AppConfig.SaveConfig(); } if (File.Exists(MainSave.CookiePath)) { MainSave.CookieList = CookieObject.LoadObject(); } else { MainSave.CookieList = new List <CookieObject>(); CookieObject.SaveObject(); } ApiHelper.StartSignJob(); }
/// <summary> /// CQ启动事件 /// </summary> /// <param name="sender">事件来源</param> /// <param name="e">事件参数</param> public void CQStartup(object sender, CQStartupEventArgs e) { e.CQLog.Info("Tips", "哔哩哔哩信息获取插件已经装载"); if (File.Exists(e.CQApi.AppDirectory + "HistorySearch.txt") != true) { File.Create(e.CQApi.AppDirectory + "HistorySearch.txt"); } }
public static int Event_eventStartup() { if (Event_eventStartupHandler != null) { CQStartupEventArgs args = new CQStartupEventArgs(AppData.CQApi, AppData.CQLog, 1001, 1001, "酷Q启动事件", "_eventStartup", 30000); Event_eventStartupHandler(typeof(CQEventExport), args); } return(0); }
public void CQStartup(object sender, CQStartupEventArgs e) { cq = e; CQSave.cq_start = e; if (!File.Exists($@"{e.CQApi.AppDirectory}data.db")) { Event_GroupMessage.CreateDB($@"{e.CQApi.AppDirectory}data.db"); e.CQLog.WriteLine(Native.Csharp.Sdk.Cqp.Enum.CQLogLevel.Info, "已创建数据库"); } }
/// <summary> /// 处理 酷Q 的启动事件回调 /// </summary> /// <param name="sender">事件的触发对象</param> /// <param name="e">事件的附加参数</param> public void CQStartup(object sender, CQStartupEventArgs e) { // 本子程序会在酷Q【主线程】中被调用。 // 无论本应用是否被启用,本函数都会在酷Q启动后执行一次,请在这里执行插件初始化代码。 // 请务必尽快返回本子程序,否则会卡住其他插件以及主程序的加载。 //if (!Directory.Exists(e.CQApi.AppDirectory)) Directory.CreateDirectory(e.CQApi.AppDirectory); // 返回如:D:\CoolQ\app\com.example.demo\ // 应用的所有数据、配置【必须】存放于此目录,避免给用户带来困扰。 }
public void CQStartup(object sender, CQStartupEventArgs e) { Global.api = e.CQApi; //这是酷Q启动事件 //Group master = new Group(e.CQApi, 490623220); //根据QQ号和酷QApi对象创建QQ私聊聊天对象 AllocConsole(); Console.WriteLine("DreamY启动成功!"); Game.LoadMonsters(); Game.LoadEquipment(); }
public void CQStartup(object sender, CQStartupEventArgs e) { MainSave.Instances.Add(new AnswerKeyword()); MainSave.CQApi = e.CQApi; MainSave.CQLog = e.CQLog; MainSave.AppDirectory = e.CQApi.AppDirectory; SQLHelper.Init(Path.Combine(MainSave.AppDirectory, "qav2.db")); if (!File.Exists(Path.Combine(MainSave.AppDirectory, "qav2.db"))) { SQLHelper.CreateDB(); } Helper.OrderListInit(); }
public void CQStartup(object sender, CQStartupEventArgs e) { try { CQSave.cq_start = e; CQSave.AppDirectory = e.CQApi.AppDirectory; CQSave.ImageDirectory = GetAppImageDirectory(); CQSave.CQLog = e.CQLog; CQSave.CQApi = e.CQApi; ini = new IniConfig(e.CQApi.AppDirectory + "Config.ini"); ini.Load(); string temp = ini.Object["OCR"]["app_id"].GetValueOrDefault(""); if (temp == "") { ini.Object["OCR"]["app_id"] = new IValue(""); ini.Object["OCR"]["app_key"] = new IValue(""); } ini.Save(); if (!File.Exists($@"{e.CQApi.AppDirectory}装备卡\框\抽卡背景.png")) { e.CQLog.Warning("错误", "数据包未安装,插件无法运行,请仔细阅读论坛插件说明安装数据包,之后重启酷Q"); } else { if (!File.Exists($@"{e.CQApi.AppDirectory}data.db")) { Event_GroupMessage.CreateDB($@"{e.CQApi.AppDirectory}data.db"); e.CQLog.WriteLine(Native.Sdk.Cqp.Enum.CQLogLevel.Info, "已创建数据库"); } else { FileInfo info = new FileInfo($@"{e.CQApi.AppDirectory}data.db"); if (info.Length == 0) { File.Delete($@"{e.CQApi.AppDirectory}data.db"); Event_GroupMessage.CreateDB($@"{e.CQApi.AppDirectory}data.db"); e.CQLog.WriteLine(Native.Sdk.Cqp.Enum.CQLogLevel.Info, "已创建数据库"); return; } Event_GroupMessage.CheckDB($@"{e.CQApi.AppDirectory}data.db", e); } } AbyssTimerHelper.Start(); } catch (Exception exc) { e.CQLog.Info("Error", exc.Message, exc.StackTrace); } }
// 接收事件 public void CQStartup(object sender, CQStartupEventArgs e) { MessagePoster.pCQ = e.CQApi; ArtificalA.Intelligence.ArtificalAI.DebugLog = true; AllocConsole(); Manager.LCards = new DataArrange("lockcards"); Manager.CPms = new DataArrange("consolepermissions"); Manager.mHot = new DataArrange("mosthotmessages"); Manager.Hots = new DataArrange("messagehots"); Manager.scrBan = new DataArrange("screenmsgbanners"); Thread thread = new Thread(new ThreadStart(MessagePoster.Poster));//创建线程 thread.Start(); Console.WriteLine("Message poster thread works properly ."); }
public void CQStartup(object sender, CQStartupEventArgs e) { ApiModel.setModel(e.CQApi, e.CQLog); FileOptions.GetInstance(); }
public void CQStartup(object sender, CQStartupEventArgs e) { }
public void CQStartup(object sender, CQStartupEventArgs e) { Common.CQApi = e.CQApi; Common.CQLog = e.CQLog; }
public void CQStartup(object obj, CQStartupEventArgs e) { //Main.Initialize(); OnStartUp?.Invoke(obj, e); }
public void CQStartup(object sender, CQStartupEventArgs e) { MainSave.AppDirectory = e.CQApi.AppDirectory; MainSave.CQApi = e.CQApi; MainSave.CQLog = e.CQLog; MainSave.ImageDirectory = CommonHelper.GetAppImageDirectory(); IniConfig ini = new IniConfig(e.CQApi.AppDirectory + "Config.ini"); ini.Load(); MainSave.ConfigMain = ini; PublicVariables.ReadOrderandAnswer(); try { WebProxy proxy = null; if (ini.Object["Proxy"]["IsEnabled"].GetValueOrDefault(0) == 1) { //代理设置 string uri, username, pwd; uri = ini.Object["Proxy"]["ProxyUri"].GetValueOrDefault(""); username = ini.Object["Proxy"]["ProxyName"].GetValueOrDefault(""); pwd = ini.Object["Proxy"]["ProxyPwd"].GetValueOrDefault(""); proxy = new WebProxy { Address = new Uri(uri), Credentials = new NetworkCredential(username, pwd) }; MainSave.Proxy = proxy; } } catch (Exception ex) { MainSave.CQLog.Warning("代理设置无效", $"代理参数有误,错误信息:{ex.Message}"); } ini = MainSave.ConfigLimit; if (ini.Object == null || ini.Object.Count == 0) { File.WriteAllText(e.CQApi.AppDirectory + "ConfigLimit.ini", "[Config]\nTimestamp=1608773153"); ini.Load(); } if (JudgeifTimestampOverday(ini.Object["Config"]["Timestamp"].GetValueOrDefault(0), CommonHelper.GetTimeStamp())) { if (File.Exists(MainSave.AppDirectory + "ConfigLimit.ini")) { File.WriteAllText(MainSave.AppDirectory + "ConfigLimit.ini", "[Config]\nTimestamp=1608773153"); MainSave.CQLog.Info("涩图机重置", "限制已重置"); } } timersTimer.Interval = 1000; timersTimer.Enabled = true; timersTimer.Elapsed += TimersTimer_Elapsed; timersTimer.Start(); MainSave.Instances.Add(new ClearLimit()); MainSave.Instances.Add(new CustomAPI()); MainSave.Instances.Add(new GetLoliconPic()); MainSave.Instances.Add(new HotSearch()); MainSave.Instances.Add(new JsonPic()); MainSave.Instances.Add(new LocalPic()); MainSave.Instances.Add(new PIDSearch()); MainSave.Instances.Add(new RankPic()); MainSave.Instances.Add(new SauceNao()); MainSave.Instances.Add(new TraceMoe()); MainSave.Instances.Add(new YandeRePic()); MainSave.Instances.Add(new YandeReTagSearch()); }