public override bool HandleMessage(Message msg) { //msg.toGroup = 735545947;// msg.fromGroup; string cmd = BOT.getAskCmd(msg); if (string.IsNullOrWhiteSpace(cmd)) { return(false); } string res = getRollString(cmd); if (!string.IsNullOrWhiteSpace(res)) { msg.str = res; msg.toGroup = msg.fromGroup; msg.to = msg.from; msg.imgs.Clear(); msg.ats.Clear(); if (msg.fromGroup > 0) { msg.ats.Add(new MessageAt(msg.from, $"@{msg.fromName}")); //msg.str = " " + msg.str; } BOT.send(msg); return(true); } return(false); }
public override bool HandleMessage(Message msg) { try { string cmd = BOT.getAskCmd(msg); if (string.IsNullOrWhiteSpace(cmd)) { return(false); } if (cmd.StartsWith("占卜")) { string res = getZhouYi(); if (res.Length > 0) { msg.str = res; BOT.sendBack(msg, true); return(true); } } } catch (Exception ex) { FileHelper.Log(ex); } return(false); }
public override bool HandleMessage(Message msg) { try { string cmd = BOT.getAskCmd(msg); if (string.IsNullOrWhiteSpace(cmd)) { return(false); } // 翻译 Regex transreg = new Regex("(\\S+)译(\\S+)\\s+"); var transmatch = transreg.Match(cmd); if (transmatch.Success) { string msgyilist = transmatch.Groups[0].ToString().Trim(); string msgtar = cmd.Substring(msgyilist.Length).Trim(); var lists = msgyilist.Split('译'); if (lists.Length >= 2 && msgtar.Length > 0) { string res = msgtar; for (int i = 0; i < lists.Length - 1; i++) { res = Translation(res, lists[i + 1], lists[i]); } msg.str = res; BOT.sendBack(msg, true); return(true); } } } catch (Exception ex) { FileHelper.Log(ex); } return(false); }
public override bool HandleMessage(Message msg) { string cmd = BOT.getAskCmd(msg); if (string.IsNullOrWhiteSpace(cmd)) { return(false); } Regex bsearchreg = new Regex("(\\S+)区有多少(\\S+)"); var bseatchres = bsearchreg.Match(cmd); bool matchSuccess = false; if (bseatchres.Success) { try { string barea = bseatchres.Groups[1].ToString().Trim() + "区"; string btar = bseatchres.Groups[2].ToString().Trim(); string res = getTitleSearch(barea, btar); msg.str = res; BOT.sendBack(msg, true); return(true); } catch { } } if (cmd.EndsWith("区谁在播") || cmd.EndsWith("区有谁在播") || cmd.EndsWith("区有谁") || cmd.EndsWith("区都有谁")) { string areaname = cmd.Substring(0, cmd.LastIndexOf('区') + 1); msg.str = getLiveNum(areaname); matchSuccess = true; } else if (cmd.EndsWith("区谁最惨")) { string areaname = cmd.Substring(0, cmd.LastIndexOf('区') + 1); msg.str = getPoorLives(areaname); matchSuccess = true; } else if (cmd.Contains("在播吗") || cmd.Contains("播了吗")) { string test = cmd.Replace("在播吗", "").Replace("播了吗", ""); string xnq = getLiveInfo(test); msg.str = getLiveInfo(test); matchSuccess = true; } else if (cmd.StartsWith("别名")) { var items = cmd.Substring(2).Trim().Split(new char[] { ' ', ',', ',' }, StringSplitOptions.RemoveEmptyEntries); if (items.Length >= 2) { setReplaceName(items[0], items[1]); setReplaceName(items[1], items[0]); msg.str = "好"; matchSuccess = true; } } else if (cmd.StartsWith("房间号")) { var items = cmd.Substring(3).Trim().Split(new char[] { ' ', ',', ',' }, StringSplitOptions.RemoveEmptyEntries); if (items.Length >= 2) { setRoomId(items[0], items[1]); msg.str = "好"; matchSuccess = true; } } else if (cmd.StartsWith("查看别名")) { var item = cmd.Substring(4).Trim(); if (item.Length > 0) { var reslist = getNames(item); msg.str = string.Join("/", reslist); matchSuccess = true; } } if (matchSuccess) { BOT.sendBack(msg, true); return(true); } // 才八点 if (cmd.StartsWith("现在几点") || cmd.StartsWith("几点了")) { try { string res = $"现在是{getNowClockCountry(20)}"; msg.str = res; BOT.sendBack(msg); return(true); } catch { } } return(false); }
public override bool HandleMessage(Message msg) { string cmd = BOT.getAskCmd(msg); if (string.IsNullOrWhiteSpace(cmd)) { return(false); } // BTC货币系统 if (msg.fromGroup > 0 && cmd == "签到") { msg.str = btc.dailyAttendance(msg.fromGroup, msg.from); //racehorse.dailyAttendance(group, user); BOT.sendBack(msg, true); return(true); } //if (cmd == "个人信息") //{ // string res = $"{btc.getUserInfo(msg.from)}\r\n{getRHInfo(msg.from)}"; // if (!string.IsNullOrWhiteSpace(res)) // { // msg.str = res; // BOT.sendBack(msg); // return false; // } //} Regex zzs = new Regex("给(.+)转(\\d+)"); var matchzzs = zzs.Match(cmd); if (matchzzs.Success) { try { string target = matchzzs.Groups[1].ToString().Trim(); long targetqq = -1; if (!long.TryParse(target, out targetqq)) { // nick name -> qq targetqq = BOT.getID(target, msg.fromGroup); // targetqq = getQQNumFromGroup(group, target.Trim()); } string res = ""; if (targetqq <= 0) { res = $"群里好像没人叫 {target} ,转账失败。"; } else { long money = long.Parse(matchzzs.Groups[2].ToString()); res = btc.transMoney(msg.from, targetqq, money); } if (!string.IsNullOrWhiteSpace(res)) { msg.str = res; BOT.sendBack(msg, true); return(true); } } catch { } } return(false); }
public override bool HandleMessage(Message msg) { try { string cmd = BOT.getAskCmd(msg); if (string.IsNullOrWhiteSpace(cmd)) { return(false); } bool isGroup = msg.fromGroup > 0 ? true : false; //string uid = msg.from.ToString(); long group = msg.fromGroup; if (!users.ContainsKey(msg.from)) { users[msg.from] = new RHUser(msg.from); } RHUser user = users[msg.from]; //BOT.log("赛马 "+cmd); if (cmd == "赛马介绍" || cmd == "赛马玩法" || cmd == "赛马说明") { msg.str = getIntroduction(); BOT.sendBack(msg); return(true); } if (cmd == "富豪榜" || cmd == "富人榜") { string res = BOT.getMoneyManager().showRichest(); if (!string.IsNullOrWhiteSpace(res)) { msg.str = res; BOT.sendBack(msg); return(true); } } if (cmd == "穷人榜") { string res = BOT.getMoneyManager().showPoorest(); if (!string.IsNullOrWhiteSpace(res)) { msg.str = res; BOT.sendBack(msg); return(true); } } if (cmd == "个人信息") { string res = $"{money.getUserInfo(msg.from)}\r\n{getRHInfo(msg.from)}"; if (!string.IsNullOrWhiteSpace(res)) { msg.str = res; BOT.sendBack(msg); return(true); } } else if (cmd == "赛马") { int num = 5; if (!matches.ContainsKey(group)) { matches[group] = new RHMatch(group, this); } matches[group].begin(num, 100); return(true); } else if (cmd == "胜率榜") { msg.str = showBigWinner(); BOT.sendBack(msg); return(true); } else if (cmd == "败率榜") { msg.str = showBigLoser(); BOT.sendBack(msg); return(true); } else if (cmd == "赌狗榜") { msg.str = showMostPlayTime(); BOT.sendBack(msg); return(true); } else { var trygetbet = Regex.Match(cmd, @"(\d+)号\s*(\d+)"); if (trygetbet.Success) { try { int roadnum = int.Parse(trygetbet.Groups[1].ToString()); int money = int.Parse(trygetbet.Groups[2].ToString()); addBet(group, user, roadnum, money); return(true); } catch (Exception ex) { FileHelper.Log(ex); } } } } catch (Exception ex) { FileHelper.Log(ex); } return(false); }