private void ClassMain_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) {//收集弹幕的地方 //Output("ReceivedRoomCount:" + e.Danmaku.CommentText); if (e.Danmaku.MsgType == BilibiliDM_PluginFramework.MsgTypeEnum.Comment || e.Danmaku.MsgType == BilibiliDM_PluginFramework.MsgTypeEnum.GiftSend) { frmMain.Order(e.Danmaku); } //frmMain.Invoke(frmMain.Order); }
private void Class1_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { if (!Status) { return; } if (e.Danmaku.CommentText == null) { return; } var mat2 = pattern2.Match(e.Danmaku.CommentText.Replace(",", ",")); if (mat2.Success) { targethwnd = FindWindow(null, "PYHHelper"); if (targethwnd == IntPtr.Zero) { return; } setting.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate { Clipboard.SetText(mat2.Groups[1].Value); SendMessage(targethwnd, 0x402, IntPtr.Zero, IntPtr.Zero); }); Log("发送点Rep请求"); } if (e.Danmaku.isAdmin == false) { return; } var mat = pattern.Match(e.Danmaku.CommentText); if (!mat.Success) { return; } targethwnd = FindWindow(null, "PYHHelper"); if (targethwnd == IntPtr.Zero) { return; } setting.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate { Clipboard.SetText(mat.Groups[1].Value); SendMessage(targethwnd, 0x401, IntPtr.Zero, IntPtr.Zero); }); //throw new NotImplementedException(); this.Log("成功观战:" + mat.Groups[1].Value); }
//收到弹幕 private void Wind_Music_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { try { var pDanmuku = e.Danmaku; foreach (System.Reflection.PropertyInfo p in pDanmuku.GetType().GetProperties()) { Debug.WriteLine("Name:{0} Value:{1}", p.Name, p.GetValue(pDanmuku, null)); } } catch (Exception pExc) { throw new Exception(pExc.Message); } }
private void InGameDanmaku_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { try { string curDanmaku = e.Danmaku.CommentText.Trim(); if (String.IsNullOrEmpty(curDanmaku)) { return; } UpdateDanmaku(Translate(e.Danmaku.CommentUser) + " : " + Translate(curDanmaku)); } catch (Exception) { } // Process.Start(@startupPath); // MessageBox.Show(@startupPath); // MessageBox.Show(e.Danmaku.CommentText); // throw new NotImplementedException(); }
private void button1_Click(object sender, EventArgs e) { //Obj.BroadCastingInfo("haha"); var danmuRawData = "{\"info\":[[0,1,25,16777215,1450888087,\"1450888075\",0,\"082b9a9b\",0],\"O_O\",[245166,\"往事如风\",0,\"0\"],[],[20,5685],[]],\"cmd\":\"DANMU_MSG\",\"roomid\":42728}"; BilibiliDM_PluginFramework.DanmakuModel danmaku = new BilibiliDM_PluginFramework.DanmakuModel(danmuRawData, 2); var danmu = new BilibiliDM_PluginFramework.ReceivedDanmakuArgs(); danmu.Danmaku = danmaku; //弹幕 //"{\"info\":[[0,1,25,16777215,1450888087,\"1450888075\",0,\"082b9a9b\",0],\"O_O\",[245166,\"往事如风\",0,\"0\"],[],[20,5685],[]],\"cmd\":\"DANMU_MSG\",\"roomid\":42728}" //礼物 //"{\"cmd\":\"SEND_GIFT\",\"data\":{\"giftName\":\"辣条\",\"num\":1,\"uname\":\"往事如风\",\"rcost\":48706,\"uid\":245166,\"top_list\":[],\"timestamp\":1450888185,\"giftId\":1,\"giftType\":0,\"action\":\"喂食\",\"super\":0,\"price\":100,\"rnd\":\"1450888075\",\"newMedal\":0,\"medal\":-1},\"roomid\":42728}" var danmaArg = new BroadcastEventArgs(danmu); Obj.BroadCastingDanmakuArgsInfo(danmaArg); }
private void Class1_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { if (e.Danmaku.MsgType == BilibiliDM_PluginFramework.MsgTypeEnum.Comment) { if (e.Danmaku.CommentText.StartsWith("点歌#")) { string song = e.Danmaku.CommentText.Substring("点歌".Length + 1).Trim(); string json = 网络.Get($"http://music.163.com/api/search/pc?limit=1&type=1&s={song}"); try { JObject obj = JObject.Parse(json); string name = obj["result"]["songs"][0]["name"].ToString(); string id = obj["result"]["songs"][0]["id"].ToString(); player.AddMusic($"http://music.163.com/song/media/outer/url?id={id.Trim()}.mp3"); this.AddDM($"已将{name}压入播放队列"); } catch { this.AddDM("Err occurred,歌不存在或者USB声卡被踢掉了"); } } } }
private void Class1_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { try { if (e == null) { return; } SpeechSynthesizer s = new SpeechSynthesizer(); if (s != null) { if (e.Danmaku.CommentText.Contains("666") || e.Danmaku.CommentText.Contains("233")) { string str = string.Empty; foreach (var item in e.Danmaku.CommentText) { str += item; str += " "; } e.Danmaku.CommentText = str; } s.Volume = 50; s.SpeakAsync(e.Danmaku.CommentText); if (e.Danmaku.CommentText.StartsWith("点歌")) { string musicname = e.Danmaku.CommentText.Replace("点歌", ""); string re = HttpGet("http://music.163.com/api/search/pc", "s=" + musicname + "&offset=0&limit=20&"); Log(re); } //Log(e.Danmaku.CommentText); } } catch (Exception) { } }
private void Class1_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { throw new NotImplementedException(); }
private void MainClass_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { if (e.Danmaku.MsgType == BilibiliDM_PluginFramework.MsgTypeEnum.Comment) { //弹幕过滤 if (isFilterDanmu) { foreach (string filter in filterStrs) { if (e.Danmaku.CommentText.Contains(filter)) { return; } } } if (isReplyOnly) { bool isContain = false; foreach (string str in containStrs) { if (e.Danmaku.CommentText.Contains(str)) { isContain = true; break; } } if (!isContain) { return; } } // 需要从info中解析uid,用于判断发送此弹幕的用户 if (!e.Danmaku.RawData.Contains("info")) { Stop(); throw new Exception("抱歉,B站弹幕信息发生了变化(没有info),无法解析相应属性,请反馈给我[email protected]"); } else { JObject jsonResponse = (JObject)JsonConvert.DeserializeObject(e.Danmaku.RawData); string uid = jsonResponse["info"][2][0].ToString(); DanmuData danmuData = new DanmuData(); danmuData.danmuText = e.Danmaku.CommentText; danmuData.userId = uid; new Thread(new ParameterizedThreadStart(ReplyDanmu)).Start(danmuData); } } else if (e.Danmaku.MsgType == BilibiliDM_PluginFramework.MsgTypeEnum.GiftSend && isReGift) { if (reGiftMutex.WaitOne(1000)) { //double nowTime = DateTime.Now.Subtract(DateTime.Parse("1970-1-1")).TotalMilliseconds; // 打断,重新开始 thankGiftDelay_timer.Enabled = false; if (isDelayReGift) { thankGiftDelay_timer.Interval = reGiftDelay_int * 1000; } else { thankGiftDelay_timer.Interval = 100; } thankGiftDelay_timer.Enabled = true; string userGiftstr = e.Danmaku.GiftUser + "\t" + e.Danmaku.GiftName; bool isContain = false; for (int i = 0; i < user_gift_List.Count; ++i) { if (((string)user_gift_List[i]) == userGiftstr) { isContain = true; break; } } if (!isContain) { user_gift_List.Add(userGiftstr); } //new Thread(new ParameterizedThreadStart(thankGiftDelay)).Start(thankStr); //if (nowTime - lastReGiftTime > Int64.Parse(reGiftDelay) * 1000) //{ // string thankStr = ""; // for (int i = 0; i < userGiftList.Count; ++i) // { // userGiftstr = (string)userGiftList[i]; // string[] unameAndgname = userGiftstr.Split('\t'); // if (unameAndgname.Length > 1) // { // Random num = new Random(); // int point = num.Next(0, reGiftStrs.Length); // thankStr = reGiftStrs[point]; // string uname = unameAndgname[0]; // string gname = unameAndgname[1]; // thankStr = thankStr.Replace("%name%", uname).Replace("%gift%", gname); // thankGift(thankStr); // } // } // userGiftList.Clear(); // lastReGiftTime = nowTime; //} reGiftMutex.ReleaseMutex(); } } }
private void Class1_ReceivedDanmaku(object sender, BilibiliDM_PluginFramework.ReceivedDanmakuArgs e) { throw new NotImplementedException(); this.Log("BBB"); this.AddDM("bbb", true); }
public BroadcastEventArgs(BilibiliDM_PluginFramework.ReceivedDanmakuArgs args) { var danmuku = args.Danmaku; RawData = danmuku.RawData; }