rubjs 2.5.4 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rubjs/index.d.ts +1 -2
- package/rubjs/index.js +1 -3
- package/rubjs/methods/extras/deleteMessagebyCount.js +9 -12
- package/rubjs/methods/index.d.ts +2 -2
- package/rubjs/network/index.js +19 -17
- package/rubjs/types/groups.d.ts +40 -14
package/package.json
CHANGED
package/rubjs/index.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import Client from "./client";
|
2
2
|
import Crypto from "./crypto";
|
3
|
-
import Markdown from "./parser";
|
4
3
|
import * as Types from "./types";
|
5
4
|
import { Filters, Utils } from "./utils";
|
6
5
|
export default Client;
|
7
|
-
export { Client, Crypto,
|
6
|
+
export { Client, Crypto, Utils, Filters, Types };
|
package/rubjs/index.js
CHANGED
@@ -36,13 +36,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
37
37
|
};
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
39
|
-
exports.Types = exports.Filters = exports.Utils = exports.
|
39
|
+
exports.Types = exports.Filters = exports.Utils = exports.Crypto = exports.Client = void 0;
|
40
40
|
const client_1 = __importDefault(require("./client"));
|
41
41
|
exports.Client = client_1.default;
|
42
42
|
const crypto_1 = __importDefault(require("./crypto"));
|
43
43
|
exports.Crypto = crypto_1.default;
|
44
|
-
const parser_1 = __importDefault(require("./parser"));
|
45
|
-
exports.Markdown = parser_1.default;
|
46
44
|
const Types = __importStar(require("./types"));
|
47
45
|
exports.Types = Types;
|
48
46
|
const utils_1 = require("./utils");
|
@@ -13,18 +13,15 @@ function deleteMessagebyCount(object_guid_1, message_id_1, count_1) {
|
|
13
13
|
return __awaiter(this, arguments, void 0, function* (object_guid, message_id, count, sort = "FromMax", filter_type) {
|
14
14
|
const countLoop = Math.ceil(count / 25);
|
15
15
|
const tasks = [];
|
16
|
-
for (let index =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
catch (error) {
|
26
|
-
console.error(`Error fetching messages: ${error}`);
|
27
|
-
}
|
16
|
+
for (let index = 1; index <= countLoop; index++) {
|
17
|
+
const res = yield this.getMessages(object_guid, message_id, "25", sort, filter_type);
|
18
|
+
if (!res.has_continue)
|
19
|
+
break;
|
20
|
+
message_id = res.new_max_id;
|
21
|
+
const messagesID = res.messages.map((message) => message.message_id);
|
22
|
+
tasks.push(this.deleteMessages(object_guid, index !== countLoop
|
23
|
+
? messagesID
|
24
|
+
: messagesID.slice(0, count - (countLoop - 1) * 25)));
|
28
25
|
}
|
29
26
|
yield Promise.allSettled(tasks);
|
30
27
|
return true;
|
package/rubjs/methods/index.d.ts
CHANGED
@@ -112,11 +112,11 @@ declare class Methods {
|
|
112
112
|
editGroupInfo(this: Client, ...args: Parameters<typeof Groups.editGroupInfo>): Promise<any>;
|
113
113
|
getBannedGroupMembers(this: Client, ...args: Parameters<typeof Groups.getBannedGroupMembers>): Promise<GroupTypes.GetBannedGroupMembers>;
|
114
114
|
getGroupAdminAccessList(this: Client, ...args: Parameters<typeof Groups.getGroupAdminAccessList>): Promise<any>;
|
115
|
-
getGroupAdminMembers(this: Client, ...args: Parameters<typeof Groups.getGroupAdminMembers>): Promise<
|
115
|
+
getGroupAdminMembers(this: Client, ...args: Parameters<typeof Groups.getGroupAdminMembers>): Promise<GroupTypes.GetGroupAdminMembers>;
|
116
116
|
getGroupOnlineCount(this: Client, ...args: Parameters<typeof Groups.getGroupOnlineCount>): Promise<any>;
|
117
117
|
getGroupAllMembers(this: Client, ...args: Parameters<typeof Groups.getGroupAllMembers>): Promise<any>;
|
118
118
|
getGroupDefaultAccess(this: Client, ...args: Parameters<typeof Groups.getGroupDefaultAccess>): Promise<any>;
|
119
|
-
getGroupInfo(this: Client, ...args: Parameters<typeof Groups.getGroupInfo>): Promise<
|
119
|
+
getGroupInfo(this: Client, ...args: Parameters<typeof Groups.getGroupInfo>): Promise<GroupTypes.GetGroupInfo>;
|
120
120
|
getGroupLink(this: Client, ...args: Parameters<typeof Groups.getGroupLink>): Promise<any>;
|
121
121
|
getGroupMentionList(this: Client, ...args: Parameters<typeof Groups.getGroupMentionList>): Promise<any>;
|
122
122
|
getGroupVoiceChatUpdates(this: Client, ...args: Parameters<typeof Groups.getGroupVoiceChatUpdates>): Promise<any>;
|
package/rubjs/network/index.js
CHANGED
@@ -186,24 +186,26 @@ class Network {
|
|
186
186
|
return;
|
187
187
|
const update = JSON.parse(crypto_1.default.decrypt(data_enc, this.client.key));
|
188
188
|
this.client.eventHandlers.forEach((_a) => __awaiter(this, [_a], void 0, function* ({ callback, filters = [], updateType }) {
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
189
|
+
if (update[updateType].length > 0) {
|
190
|
+
for (let messageData of update[updateType]) {
|
191
|
+
if (!messageData)
|
192
|
+
return;
|
193
|
+
const isValid = filters.length === 0 ||
|
194
|
+
filters.every((filter) => {
|
195
|
+
if (typeof filter === "function")
|
196
|
+
return filter(messageData);
|
197
|
+
for (let filterCriteria of filter) {
|
198
|
+
let isMatch = filterCriteria(messageData);
|
199
|
+
if (isMatch === true)
|
200
|
+
return true;
|
201
|
+
}
|
202
|
+
return false;
|
203
|
+
});
|
204
|
+
const dataMessage = new types_1.Message(this.client, messageData);
|
205
|
+
if (isValid) {
|
206
|
+
yield callback(dataMessage);
|
201
207
|
}
|
202
|
-
|
203
|
-
});
|
204
|
-
const dataMessage = new types_1.Message(this.client, messageData);
|
205
|
-
if (isValid) {
|
206
|
-
yield callback(dataMessage);
|
208
|
+
}
|
207
209
|
}
|
208
210
|
}));
|
209
211
|
}
|
package/rubjs/types/groups.d.ts
CHANGED
@@ -2,6 +2,16 @@ import MessageUpdate, { ChatUpdates } from "./decorators";
|
|
2
2
|
interface ChatReactionSetting {
|
3
3
|
reaction_type: string;
|
4
4
|
}
|
5
|
+
interface AvatarThumbnail {
|
6
|
+
file_id: string;
|
7
|
+
mime: string;
|
8
|
+
dc_id: string;
|
9
|
+
access_hash_rec: string;
|
10
|
+
}
|
11
|
+
interface OnlineTime {
|
12
|
+
type: string;
|
13
|
+
exact_time: number;
|
14
|
+
}
|
5
15
|
interface Group {
|
6
16
|
group_guid: string;
|
7
17
|
group_title: string;
|
@@ -75,21 +85,13 @@ interface GroupMember {
|
|
75
85
|
member_guid: string;
|
76
86
|
first_name: string;
|
77
87
|
last_name: string;
|
78
|
-
avatar_thumbnail:
|
79
|
-
file_id: string;
|
80
|
-
mime: string;
|
81
|
-
dc_id: string;
|
82
|
-
access_hash_rec: string;
|
83
|
-
};
|
88
|
+
avatar_thumbnail: AvatarThumbnail;
|
84
89
|
is_verified: boolean;
|
85
90
|
is_deleted: boolean;
|
86
91
|
last_online: number;
|
87
92
|
join_type: string;
|
88
93
|
username: string;
|
89
|
-
online_time:
|
90
|
-
type: string;
|
91
|
-
exact_time: number;
|
92
|
-
};
|
94
|
+
online_time: OnlineTime;
|
93
95
|
}
|
94
96
|
interface AddGroup {
|
95
97
|
group: Group;
|
@@ -122,8 +124,32 @@ interface BanGroupMember {
|
|
122
124
|
}
|
123
125
|
interface GetBannedGroupMembers {
|
124
126
|
in_chat_members: GroupMember[];
|
125
|
-
next_start_id:
|
126
|
-
has_continue:
|
127
|
-
timestamp:
|
127
|
+
next_start_id: string;
|
128
|
+
has_continue: boolean;
|
129
|
+
timestamp: string;
|
130
|
+
}
|
131
|
+
interface GetGroupInfo {
|
132
|
+
group: Group;
|
133
|
+
chat: Chat;
|
134
|
+
timestamp: string;
|
135
|
+
}
|
136
|
+
interface GetGroupAdminMembers {
|
137
|
+
in_chat_members: {
|
138
|
+
member_type: string;
|
139
|
+
member_guid: string;
|
140
|
+
first_name: string;
|
141
|
+
avatar_thumbnail: AvatarThumbnail;
|
142
|
+
is_verified: boolean;
|
143
|
+
is_deleted: boolean;
|
144
|
+
last_online: number;
|
145
|
+
promoted_by_object_guid: string;
|
146
|
+
promoted_by_object_type: string;
|
147
|
+
join_type: string;
|
148
|
+
username: string;
|
149
|
+
online_time: OnlineTime;
|
150
|
+
}[];
|
151
|
+
next_start_id: string;
|
152
|
+
has_continue: boolean;
|
153
|
+
timestamp: string;
|
128
154
|
}
|
129
|
-
export { AddGroup, DeleteNoAccessGroupChat, CreateGroupVoiceChat, AddGroupMembers, BanGroupMember, GetBannedGroupMembers };
|
155
|
+
export { AddGroup, DeleteNoAccessGroupChat, CreateGroupVoiceChat, AddGroupMembers, BanGroupMember, GetBannedGroupMembers, GetGroupInfo, GetGroupAdminMembers, };
|