alemonjs 2.1.43 → 2.1.45

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013-present, Yuxi (Evan) You
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIdED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -61,7 +61,9 @@ export function updateConfig(action, key, value = []) {
61
61
  }
62
62
  current = current[currentKey];
63
63
  }
64
- delete current[keys[keys.length - 1]];
64
+ const delKey = keys[keys.length - 1];
65
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
66
+ delete current[delKey];
65
67
  } else if (action === 'get') {
66
68
  for (let i = 0; i < keys.length; i++) {
67
69
  const currentKey = keys[i];
@@ -1,4 +1,4 @@
1
- import { DataEnums, EventKeys, Events, User } from '../types';
1
+ import { DataEnums, EventKeys, Events, User, GuildInfo, ChannelInfo, MemberInfo, RoleInfo, PaginationParams, PaginatedResult } from '../types';
2
2
  import { Result } from '../core/utils';
3
3
  import { Format } from './message-format';
4
4
  type Options = {
@@ -21,13 +21,99 @@ export declare const useMessage: <T extends EventKeys>(event: Events[T]) => read
21
21
  format: Format | DataEnums[];
22
22
  replyId?: string;
23
23
  } | DataEnums[]): Promise<Result[]>;
24
+ delete(params?: {
25
+ messageId?: string;
26
+ }): Promise<Result>;
27
+ edit(params: {
28
+ format: Format | DataEnums[];
29
+ messageId?: string;
30
+ }): Promise<Result>;
31
+ pin(params?: {
32
+ messageId?: string;
33
+ }): Promise<Result>;
34
+ unpin(params?: {
35
+ messageId?: string;
36
+ }): Promise<Result>;
37
+ get(params?: {
38
+ messageId?: string;
39
+ }): Promise<Result>;
24
40
  }];
25
41
  export declare const useMember: <T extends EventKeys>(event: Events[T]) => readonly [{
42
+ info: (params: {
43
+ userId: string;
44
+ guildId?: string;
45
+ }) => Promise<Result<MemberInfo | null>>;
26
46
  information: (params: {
27
47
  userId: string;
28
- }) => Promise<Result<any>>;
48
+ }) => Promise<Result<MemberInfo>>;
49
+ list: (params?: {
50
+ guildId?: string;
51
+ pagination?: PaginationParams;
52
+ }) => Promise<Result<PaginatedResult<MemberInfo>>>;
53
+ kick: (params: {
54
+ userId: string;
55
+ guildId?: string;
56
+ }) => Promise<Result>;
57
+ ban: (params: {
58
+ userId: string;
59
+ guildId?: string;
60
+ reason?: string;
61
+ duration?: number;
62
+ }) => Promise<Result>;
63
+ unban: (params: {
64
+ userId: string;
65
+ guildId?: string;
66
+ }) => Promise<Result>;
67
+ search: (params: {
68
+ keyword: string;
69
+ guildId?: string;
70
+ limit?: number;
71
+ }) => Promise<Result>;
72
+ mute(params: {
73
+ userId: string;
74
+ duration: number;
75
+ guildId?: string;
76
+ }): Promise<Result>;
77
+ admin(params: {
78
+ userId: string;
79
+ enable: boolean;
80
+ guildId?: string;
81
+ }): Promise<Result>;
82
+ card(params: {
83
+ userId: string;
84
+ card: string;
85
+ guildId?: string;
86
+ }): Promise<Result>;
87
+ title(params: {
88
+ userId: string;
89
+ title: string;
90
+ guildId?: string;
91
+ duration?: number;
92
+ }): Promise<Result>;
93
+ }];
94
+ export declare const useChannel: <T extends EventKeys>(event: Events[T]) => readonly [{
95
+ info: (params?: {
96
+ channelId?: string;
97
+ }) => Promise<Result<ChannelInfo | null>>;
98
+ list: (params?: {
99
+ guildId?: string;
100
+ }) => Promise<Result<ChannelInfo[]>>;
101
+ create: (params: {
102
+ name: string;
103
+ type?: string;
104
+ parentId?: string;
105
+ guildId?: string;
106
+ }) => Promise<Result<ChannelInfo | null>>;
107
+ update: (params: {
108
+ channelId: string;
109
+ name?: string;
110
+ topic?: string;
111
+ position?: number;
112
+ }) => Promise<Result>;
113
+ delete: (params: {
114
+ channelId: string;
115
+ }) => Promise<Result>;
29
116
  }];
30
- export declare const useChannel: <T extends EventKeys>(event: Events[T]) => readonly [{}];
31
117
  export declare const useSend: <T extends EventKeys>(event: Events[T]) => (...val: DataEnums[]) => Promise<Result[]>;
32
118
  export declare const useSends: <T extends EventKeys>(event: Events[T]) => readonly [(params?: DataEnums[] | {
33
119
  format: Format | DataEnums[];
@@ -37,10 +123,146 @@ export declare const unChildren: (name?: string) => void;
37
123
  export declare const onSelects: <T extends EventKeys[] | EventKeys>(values: T) => T;
38
124
  export declare const createSelects: <T extends EventKeys[] | EventKeys>(values: T) => T;
39
125
  export declare const useClient: <T extends object>(event: any, _ApiClass: new (...args: any[]) => T) => readonly [T];
126
+ export declare const useGuild: <T extends EventKeys>(event: Events[T]) => readonly [{
127
+ info: (params?: {
128
+ guildId?: string;
129
+ }) => Promise<Result<GuildInfo | null>>;
130
+ list: () => Promise<Result<GuildInfo[]>>;
131
+ update(params: {
132
+ name?: string;
133
+ guildId?: string;
134
+ }): Promise<Result>;
135
+ leave(params?: {
136
+ guildId?: string;
137
+ isDismiss?: boolean;
138
+ }): Promise<Result>;
139
+ mute(params: {
140
+ enable: boolean;
141
+ guildId?: string;
142
+ }): Promise<Result>;
143
+ }];
144
+ export declare const useRole: <T extends EventKeys>(event: Events[T]) => readonly [{
145
+ list: (params?: {
146
+ guildId?: string;
147
+ }) => Promise<Result<RoleInfo[]>>;
148
+ create: (params: {
149
+ name: string;
150
+ color?: number;
151
+ permissions?: string;
152
+ guildId?: string;
153
+ }) => Promise<Result<RoleInfo | null>>;
154
+ update: (params: {
155
+ roleId: string;
156
+ name?: string;
157
+ color?: number;
158
+ permissions?: string;
159
+ guildId?: string;
160
+ }) => Promise<Result>;
161
+ delete: (params: {
162
+ roleId: string;
163
+ guildId?: string;
164
+ }) => Promise<Result>;
165
+ assign: (params: {
166
+ userId: string;
167
+ roleId: string;
168
+ guildId?: string;
169
+ }) => Promise<Result>;
170
+ remove: (params: {
171
+ userId: string;
172
+ roleId: string;
173
+ guildId?: string;
174
+ }) => Promise<Result>;
175
+ }];
176
+ export declare const useReaction: <T extends EventKeys>(event: Events[T]) => readonly [{
177
+ add: (params: {
178
+ emojiId: string;
179
+ messageId?: string;
180
+ }) => Promise<Result>;
181
+ remove: (params: {
182
+ emojiId: string;
183
+ messageId?: string;
184
+ }) => Promise<Result>;
185
+ list: (params: {
186
+ emojiId: string;
187
+ messageId?: string;
188
+ limit?: number;
189
+ }) => Promise<Result>;
190
+ }];
40
191
  export declare const useMe: () => readonly [{
41
192
  info: () => Promise<Result<User | null>>;
42
- guilds: () => Promise<Result<User | null>>;
193
+ guilds: () => Promise<Result<GuildInfo[]>>;
43
194
  threads: () => Promise<Result<User | null>>;
44
195
  friends: () => Promise<Result<User | null>>;
45
196
  }];
197
+ export declare const useRequest: () => readonly [{
198
+ friend: (params: {
199
+ flag: string;
200
+ approve: boolean;
201
+ remark?: string;
202
+ }) => Promise<Result>;
203
+ guild: (params: {
204
+ flag: string;
205
+ subType: string;
206
+ approve: boolean;
207
+ reason?: string;
208
+ }) => Promise<Result>;
209
+ }];
210
+ export declare const useUser: () => readonly [{
211
+ info: (params: {
212
+ userId: string;
213
+ }) => Promise<Result<User | null>>;
214
+ }];
215
+ export declare const useMedia: <T extends EventKeys>(event: Events[T]) => readonly [{
216
+ upload: (params: {
217
+ type: "image" | "audio" | "video" | "file";
218
+ url?: string;
219
+ data?: string;
220
+ name?: string;
221
+ }) => Promise<Result>;
222
+ sendChannel: (params: {
223
+ type: "image" | "audio" | "video" | "file";
224
+ url?: string;
225
+ data?: string;
226
+ name?: string;
227
+ channelId?: string;
228
+ }) => Promise<Result>;
229
+ sendUser: (params: {
230
+ userId: string;
231
+ type: "image" | "audio" | "video" | "file";
232
+ url?: string;
233
+ data?: string;
234
+ name?: string;
235
+ }) => Promise<Result>;
236
+ }];
237
+ export declare const useHistory: <T extends EventKeys>(event: Events[T]) => readonly [{
238
+ list: (params?: {
239
+ channelId?: string;
240
+ limit?: number;
241
+ before?: string;
242
+ after?: string;
243
+ }) => Promise<Result>;
244
+ }];
245
+ export declare const usePermission: <T extends EventKeys>(event: Events[T]) => readonly [{
246
+ get: (params: {
247
+ userId: string;
248
+ channelId?: string;
249
+ }) => Promise<Result>;
250
+ set: (params: {
251
+ userId: string;
252
+ allow?: string;
253
+ deny?: string;
254
+ channelId?: string;
255
+ }) => Promise<Result>;
256
+ }];
257
+ export declare const useAnnounce: <T extends EventKeys>(event: Events[T]) => readonly [{
258
+ set: (params: {
259
+ messageId: string;
260
+ channelId?: string;
261
+ guildId?: string;
262
+ }) => Promise<Result>;
263
+ remove: (params?: {
264
+ messageId?: string;
265
+ guildId?: string;
266
+ }) => Promise<Result>;
267
+ }];
46
268
  export {};