public override CoolQRouteMessage OnMessageReceived(CoolQScopeEventArgs scope) { var routeMsg = scope.RouteMessage; string userName = Decode(UserName); if (string.IsNullOrEmpty(userName)) { return(routeMsg.ToSource(DefaultReply.ParamMissing)); } BllUserRole bllUserRole = new BllUserRole(); OldSiteApiClient client = new OldSiteApiClient(); int userNum = client.GetUser(UserComponent.FromUserName(UserName), out var userObj); if (userNum == 0) { return(routeMsg.ToSource(DefaultReply.IdNotFound, true)); } if (userNum > 1) { // ignored } var role = bllUserRole.GetUserRoleByQq(long.Parse(routeMsg.UserId)); if (role.Count != 0) { if (role[0].CurrentUname == userObj.UserName) { return(routeMsg.ToSource("我早就认识你啦.", true)); } string msg = role[0].CurrentUname + ",我早就认识你啦. 有什么问题请找Mother Ship(扔锅)"; return(routeMsg.ToSource(msg, true)); } var newRole = new TableUserRole { UserId = userObj.UserId, Role = "creep", QQ = long.Parse(routeMsg.UserId), LegacyUname = "[]", CurrentUname = userObj.UserName, IsBanned = false, RepeatCount = 0, SpeakingCount = 0, Mode = 0, }; var exist = bllUserRole.GetUserRoleByUid(userObj.UserId); if (exist != null && exist.Count > 0) { return(routeMsg.ToSource("这个账号已经被QQ: " + exist.First().QQ + "绑定啦,请联系妈船或对方QQ哦.")); } int c = bllUserRole.InsertUserRole(newRole); return(c < 1 ? routeMsg.ToSource("由于各种强大的原因,绑定失败..") : routeMsg.ToSource("明白了," + userObj.UserName + ",多好的名字呢.")); }
public override CommonMessageResponse Message_Received(CommonMessage messageObj) { string osuId = Decode(OsuId); if (string.IsNullOrEmpty(osuId)) { return(new CommonMessageResponse(LoliReply.ParamMissing, messageObj)); } BllUserRole bllUserRole = new BllUserRole(); int userNum = OldSiteApi.GetUser(OsuId, out var userObj); if (userNum == 0) { return(new CommonMessageResponse(LoliReply.IdNotFound, messageObj, true)); } if (userNum > 1) { // ignored } var role = bllUserRole.GetUserRoleByQq(long.Parse(messageObj.UserId)); if (role.Count != 0) { if (role[0].CurrentUname == userObj.username) { return(new CommonMessageResponse("我早就认识你啦.", messageObj, true)); } string msg = role[0].CurrentUname + ",我早就认识你啦. 有什么问题请找Mother Ship(扔锅)"; return(new CommonMessageResponse(msg, messageObj, true)); } var newRole = new TblUserRole { UserId = long.Parse(userObj.user_id), Role = "creep", QQ = long.Parse(messageObj.UserId), LegacyUname = "[]", CurrentUname = userObj.username, IsBanned = false, RepeatCount = 0, SpeakingCount = 0, Mode = 0, }; int c = bllUserRole.InsertUserRole(newRole); return(c < 1 ? new CommonMessageResponse("由于各种强大的原因,绑定失败..", messageObj) : new CommonMessageResponse("明白了," + userObj.username + ",多好的名字呢.", messageObj)); }