/// <summary> /// 异步修改群信息 /// </summary> /// <param name="groupNumber">要进行修改的群号</param> /// <param name="config">群信息。其中不进行修改的值请置为 <see langword="null"/></param> public Task ChangeGroupConfigAsync(long groupNumber, IGroupConfig config) { CheckConnected(); byte[] payload = JsonSerializer.SerializeToUtf8Bytes(new { sessionKey = SessionInfo.SessionKey, target = groupNumber, config }, JsonSerializeOptionsFactory.IgnoreNulls); return(InternalHttpPostAsync($"{SessionInfo.Options.BaseUrl}/groupConfig", payload, SessionInfo.Canceller.Token)); }
/// <summary> /// 异步修改群信息 /// </summary> /// <exception cref="InvalidOperationException"/> /// <exception cref="PermissionDeniedException"/> /// <exception cref="TargetNotFoundException"/> /// <param name="groupNumber">要进行修改的群号</param> /// <param name="config">群信息。其中不进行修改的值请置为 <see langword="null"/></param> public Task ChangeGroupConfigAsync(long groupNumber, IGroupConfig config) { InternalSessionInfo session = SafeGetSession(); byte[] payload = JsonSerializer.SerializeToUtf8Bytes(new { sessionKey = session.SessionKey, target = groupNumber, config }, JsonSerializeOptionsFactory.IgnoreNulls); return(InternalHttpPostAsync(session.Client, $"{session.Options.BaseUrl}/groupConfig", payload, session.Token)); }
/// <summary> /// 异步修改群信息 /// </summary> /// <exception cref="InvalidOperationException"/> /// <exception cref="PermissionDeniedException"/> /// <exception cref="TargetNotFoundException"/> /// <param name="groupNumber">要进行修改的群号</param> /// <param name="config">群信息。其中不进行修改的值请置为 <see langword="null"/></param> public Task ChangeGroupConfigAsync(long groupNumber, IGroupConfig config) { InternalSessionInfo session = SafeGetSession(); var payload = new { sessionKey = session.SessionKey, target = groupNumber, config }; return(session.Client.PostAsJsonAsync($"{session.Options.BaseUrl}/groupConfig", payload, JsonSerializeOptionsFactory.IgnoreNulls, session.Token) .AsApiRespAsync(session.Token)); }
/// <summary> /// SVデータ取得 /// </summary> public IEnumerator Login(RuntimePlatform platform, IManifestLoader loader, IGroupConfig config) { yield break; }
/// <inheritdoc/> public abstract Task ChangeGroupConfigAsync(long groupNumber, IGroupConfig config, CancellationToken token = default);
public void checkAndProcessReqQueue() { if (reqs.Count < 1) { return; } DateTime start = DateTime.Now; MainHolder.broadcaster.broadcastToAdminGroup("[队列DEBUG]\n长度=" + reqs.Count); Dictionary <long, GroupEntranceInfo> fails = new Dictionary <long, GroupEntranceInfo>(); string log = ""; int pass = 0; int fail = 0; foreach (KeyValuePair <long, GroupEntranceInfo> d in reqs) { if (d.Value == null) { continue; } IGroupInfo g = getGroupInfo(d.Value.group.Id); IGroupConfig gc = getGroupConf(d.Value.group.Id); int countmember = memberCountGroup(d.Value.group.Id); if (g != null) { bool success = true; int maxmember = groupMaxMember; long q = d.Value.qq.qq; QBaseInfo qi = d.Value.qq; int trusted = DataBase.me.isUserTrusted(q); //QQ q = MainHolder.session.get; if (DataBase.me.isUserOperator(q)) { MainHolder.session.HandleGroupApplyAsync(d.Value.igpargs, GroupApplyActions.Allow); log += qi.nickname + "-> 是管理员 √\n"; pass++; } else if (trusted >= 0) { long opid = DataBase.me.getUserTrustOperator(q); MainHolder.session.HandleGroupApplyAsync(d.Value.igpargs, GroupApplyActions.Allow); if (trusted == 1) { DataBase.me.removeUserTrustlist(q); log += qi.nickname + " -> 信任一次 [ATUSER(" + opid + ")] √\n"; } else { log += qi.nickname + " -> 永久信任 [ATUSER(" + opid + ")] √\n"; } pass++; } else if (memberCountGroup(g.Id) >= maxmember - 10) { long gpid = getLeastMemberGroup(); MainHolder.session.HandleGroupApplyAsync(d.Value.igpargs, GroupApplyActions.Deny, "该群成员已达上限,请加入" + gpid); log += qi.nickname + " -> 群满 ×\n"; fail++; } else if (DataBase.me.isUserBlacklisted(q) && DataBase.me.connected)//已被拉黑 { MainHolder.session.HandleGroupApplyAsync(d.Value.igpargs, GroupApplyActions.Deny, "您在LUYE通用黑名单中,不允许加群。"); log += qi.nickname + " -> 已被拉黑 ×\n"; fail++; } else if (DataBase.me.whichGroupsAreTheUserIn(q).Count > 0 && DataBase.me.connected) {//重复加群 if (!DataBase.me.isMEIgnoreGroup(g.Id)) { MainHolder.session.HandleGroupApplyAsync(d.Value.igpargs, GroupApplyActions.Deny, "您加入了其它鹿野群"); log += qi.nickname + " -> 重复加群 ×\n"; fail++; } else { MainHolder.session.HandleGroupApplyAsync(d.Value.igpargs, GroupApplyActions.Allow); log += qi.nickname + " -> 不查重 √\n"; pass++; } } else { int level = ThirdPartAPIs.getQQLevel(q, 3); if (level < 0) { log += qi.nickname + " -> 等级验证失败 E\n"; fails.Add(d.Key, d.Value); } else if (level < 16) { MainHolder.session.HandleGroupApplyAsync(d.Value.igpargs, GroupApplyActions.Deny, "您的QQ等级(" + level + ")低于设定值(16)"); log += qi.nickname + " -> 等级过低 ×\n"; fail++; } else { log += qi.nickname + " -> 符合要求 √\n"; pass++; } } } } MainHolder.broadcaster.broadcastToAdminGroup("[延迟通过队列处理结果]\n" + log + "--------------\n" + pass + "通过," + fail + "拒绝," + fails.Count() + "错误\n\n处理耗时" + (DateTime.Now - start).TotalSeconds + "s"); reqs.Clear(); reqs = fails; }