-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
519 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/EleCho.GoCqHttpSdk/Action/CqGetGroupMemberListAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using EleCho.GoCqHttpSdk.Action.Model.Params; | ||
|
||
namespace EleCho.GoCqHttpSdk.Action | ||
{ | ||
/// <summary> | ||
/// 获取群成员列表操作 | ||
/// </summary> | ||
public class CqGetGroupMemberListAction : CqAction | ||
{ | ||
/// <summary> | ||
/// 操作类型: 获取群成员列表 | ||
/// </summary> | ||
public override CqActionType ActionType => CqActionType.GetGroupMemberList; | ||
|
||
/// <summary> | ||
/// 群号 | ||
/// </summary> | ||
public long GroupId { get; } | ||
|
||
/// <summary> | ||
/// 不使用缓存 | ||
/// </summary> | ||
public bool NoCache { get; } | ||
|
||
/// <summary> | ||
/// 实例化对象 (NoCache = false) | ||
/// </summary> | ||
/// <param name="groupId">群号</param> | ||
public CqGetGroupMemberListAction(long groupId) : this(groupId, false) | ||
{ } | ||
|
||
/// <summary> | ||
/// 实例化对象 | ||
/// </summary> | ||
/// <param name="groupId">群号</param> | ||
/// <param name="noCache">不使用缓存</param> | ||
public CqGetGroupMemberListAction(long groupId, bool noCache) | ||
{ | ||
GroupId = groupId; | ||
NoCache = noCache; | ||
} | ||
|
||
internal override CqActionParamsModel GetParamsModel() | ||
{ | ||
return new CqGetGroupMemberListActionParamsModel(GroupId, NoCache); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/EleCho.GoCqHttpSdk/Action/Model/Params/CqGetGroupMemberListActionParamsModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace EleCho.GoCqHttpSdk.Action.Model.Params | ||
{ | ||
internal class CqGetGroupMemberListActionParamsModel : CqActionParamsModel | ||
{ | ||
public CqGetGroupMemberListActionParamsModel(long group_id, bool no_cache) | ||
{ | ||
this.group_id = group_id; | ||
this.no_cache = no_cache; | ||
} | ||
|
||
public long group_id { get; } | ||
public bool no_cache { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/EleCho.GoCqHttpSdk/Action/Model/ResultData/CqGetGroupMemberListActionResultDataModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using EleCho.GoCqHttpSdk.DataStructure.Model; | ||
|
||
namespace EleCho.GoCqHttpSdk.Action.Model.ResultData | ||
{ | ||
internal class CqGetGroupMemberListActionResultDataModel : CqActionResultDataModel, IList<CqGroupMemberModel> | ||
{ | ||
readonly List<CqGroupMemberModel> list = new List<CqGroupMemberModel>(); | ||
|
||
public CqGroupMemberModel this[int index] { get => list[index]; set => list[index] = value; } | ||
|
||
public int Count => list.Count; | ||
|
||
public bool IsReadOnly => false; | ||
|
||
public void Add(CqGroupMemberModel item) => list.Add(item); | ||
public void Clear() => list.Clear(); | ||
public bool Contains(CqGroupMemberModel item) => list.Contains(item); | ||
public void CopyTo(CqGroupMemberModel[] array, int arrayIndex) => list.CopyTo(array, arrayIndex); | ||
public IEnumerator<CqGroupMemberModel> GetEnumerator() => list.GetEnumerator(); | ||
public int IndexOf(CqGroupMemberModel item) => list.IndexOf(item); | ||
public void Insert(int index, CqGroupMemberModel item) => list.Insert(index, item); | ||
public bool Remove(CqGroupMemberModel item) => list.Remove(item); | ||
public void RemoveAt(int index) => list.RemoveAt(index); | ||
IEnumerator IEnumerable.GetEnumerator() => list.GetEnumerator(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/EleCho.GoCqHttpSdk/Action/Result/CqGetGroupMemberListActionResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using EleCho.GoCqHttpSdk.Action.Model.ResultData; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace EleCho.GoCqHttpSdk.Action | ||
{ | ||
/// <summary> | ||
/// 获取群成员列表操作结果 | ||
/// </summary> | ||
public record class CqGetGroupMemberListActionResult : CqActionResult | ||
{ | ||
internal CqGetGroupMemberListActionResult() { } | ||
|
||
/// <summary> | ||
/// 成员 | ||
/// </summary> | ||
public IReadOnlyList<CqGroupMember> Members { get; private set; } = new List<CqGroupMember>(0).AsReadOnly(); | ||
|
||
internal override void ReadDataModel(CqActionResultDataModel? model) | ||
{ | ||
if (model is not CqGetGroupMemberListActionResultDataModel m) | ||
throw new ArgumentException(); | ||
|
||
Members = m.Select(fm => new CqGroupMember(fm)).ToList().AsReadOnly(); | ||
} | ||
} | ||
} |
Oops, something went wrong.