MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / parseSeatActionArgs

Function parseSeatActionArgs

admin_board/admin_board.ts:1109–1133  ·  view source on GitHub ↗
(remainder: string)

Source from the content-addressed store, hash-verified

1107 if (tokens.length > 1) {
1108 const targetArg = tokens[tokens.length - 1];
1109 const targetlessIdentifiers = parseUserIdentifiers(
1110 tokens.slice(0, -1).join(" "),
1111 );
1112 if (targetlessIdentifiers) {
1113 return {
1114 identifiers: targetlessIdentifiers,
1115 targetArg,
1116 };
1117 }
1118 }
1119
1120 return { identifiers: [] };
1121}
1122
1123async function findUserInChatParticipants(
1124 target: TargetChat,
1125 identifier: string,
1126): Promise<Api.User | undefined> {
1127 const client = await getGlobalClient();
1128 if (!client) throw new Error("Telegram 客户端未初始化");
1129
1130 const isNumeric = /^-?\d+$/.test(identifier);
1131 const username = isNumeric ? "" : identifier.replace(/^@/, "").toLowerCase();
1132 const participants = await client.getParticipants(target.entity, {
1133 showTotal: false,
1134 ...(username ? { search: username } : {}),
1135 });
1136

Callers 1

handleSeatActionFunction · 0.85

Calls 1

parseUserIdentifiersFunction · 0.85

Tested by

no test coverage detected