rubjs 3.1.1 → 3.1.2
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/README.md +1 -1
- package/lib/core/bot/bot.d.ts +3 -3
- package/lib/core/bot/methods/messages/editChatKeypad.d.ts +1 -1
- package/lib/core/bot/methods/messages/editChatKeypad.js +2 -4
- package/lib/core/bot/methods/messages/editMessageKeypad.d.ts +1 -1
- package/lib/core/bot/methods/messages/editMessageKeypad.js +2 -2
- package/lib/core/bot/network/index.js +1 -0
- package/lib/core/bot/types/bot.type.d.ts +3 -1
- package/package.json +7 -2
package/README.md
CHANGED
@@ -88,4 +88,4 @@ npm install rubjs
|
|
88
88
|
### مستندات و آموزشها
|
89
89
|
برای مشاهده مستندات کامل، نمونههای بیشتر و راهنمای استفاده، به صفحه رسمی مستندات RubJS مراجعه کنید:
|
90
90
|
|
91
|
-
🔗 [مشاهده مستندات RubJS](https://hadi-rostami.github.io/rubjs-
|
91
|
+
🔗 [مشاهده مستندات RubJS](https://hadi-rostami.github.io/rubjs-docs/)
|
package/lib/core/bot/bot.d.ts
CHANGED
@@ -2,7 +2,7 @@ import SessionManager from '../../utils/session';
|
|
2
2
|
import Message from './contexts/message.context';
|
3
3
|
import Methods from './methods';
|
4
4
|
import Network from './network';
|
5
|
-
import { BotType, ContextMap, Handler, SessionType } from './types/bot.type';
|
5
|
+
import { BotType, ContextMap, Handler, NestedFilter, SessionType } from './types/bot.type';
|
6
6
|
import { FastifyInstance } from 'fastify';
|
7
7
|
declare class Bot extends Methods {
|
8
8
|
token: SessionType;
|
@@ -18,8 +18,8 @@ declare class Bot extends Methods {
|
|
18
18
|
bot?: BotType;
|
19
19
|
constructor(token: SessionType);
|
20
20
|
on<T extends keyof typeof this.handlers>(type: T, handler: (ctx: ContextMap[T]) => Promise<void>): void;
|
21
|
-
on<T extends keyof typeof this.handlers>(type: T, filters:
|
21
|
+
on<T extends keyof typeof this.handlers>(type: T, filters: NestedFilter<ContextMap[T]>, handler: (ctx: ContextMap[T]) => Promise<void>): void;
|
22
22
|
command(prefix: string | RegExp, handler: (ctx: Message) => Promise<void>): void;
|
23
|
-
command(prefix: string | RegExp, filters:
|
23
|
+
command(prefix: string | RegExp, filters: NestedFilter<ContextMap['message']>, handler: (ctx: Message) => Promise<void>): void;
|
24
24
|
}
|
25
25
|
export default Bot;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import Bot from '../../bot';
|
2
2
|
import { ChatKeypadTypeEnum, Keypad } from '../../types/models';
|
3
|
-
declare function editChatKeypad(this: Bot, chat_id: string,
|
3
|
+
declare function editChatKeypad(this: Bot, chat_id: string, chat_keypad: Keypad, chat_keypad_type?: ChatKeypadTypeEnum): Promise<any>;
|
4
4
|
export default editChatKeypad;
|
@@ -1,14 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const models_1 = require("../../types/models");
|
4
|
-
async function editChatKeypad(chat_id,
|
4
|
+
async function editChatKeypad(chat_id, chat_keypad, chat_keypad_type = models_1.ChatKeypadTypeEnum.New) {
|
5
5
|
const data = {
|
6
6
|
chat_id,
|
7
|
-
|
7
|
+
chat_keypad,
|
8
8
|
chat_keypad_type,
|
9
9
|
};
|
10
|
-
if (chat_keypad)
|
11
|
-
data.chat_keypad = chat_keypad;
|
12
10
|
return await this.builder('editChatKeypad', data);
|
13
11
|
}
|
14
12
|
exports.default = editChatKeypad;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import Bot from '../../bot';
|
2
2
|
import { InlineKeypad } from '../../types/models';
|
3
|
-
declare function editMessageKeypad(this: Bot, chat_id: string,
|
3
|
+
declare function editMessageKeypad(this: Bot, chat_id: string, message_id: string, inline_keypad?: InlineKeypad): Promise<any>;
|
4
4
|
export default editMessageKeypad;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
async function editMessageKeypad(chat_id,
|
3
|
+
async function editMessageKeypad(chat_id, message_id, inline_keypad) {
|
4
4
|
const data = {
|
5
5
|
chat_id,
|
6
|
-
|
6
|
+
message_id,
|
7
7
|
inline_keypad,
|
8
8
|
};
|
9
9
|
return await this.builder('editMessageKeypad', data);
|
@@ -19,8 +19,10 @@ export interface ContextMap {
|
|
19
19
|
message: Message;
|
20
20
|
inline: InlineMessage;
|
21
21
|
}
|
22
|
+
export type FilterFn<T> = (ctx: T) => boolean | Promise<boolean>;
|
23
|
+
export type NestedFilter<T> = Array<FilterFn<T> | FilterFn<T>[]>;
|
22
24
|
export type Handler<T> = {
|
23
|
-
filters:
|
25
|
+
filters: NestedFilter<T>;
|
24
26
|
handler: (ctx: T) => Promise<void>;
|
25
27
|
prefix?: string | RegExp;
|
26
28
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "rubjs",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.2",
|
4
4
|
"main": "lib/index.js",
|
5
5
|
"types": "lib/index.d.ts",
|
6
6
|
"keywords": [
|
@@ -9,6 +9,11 @@
|
|
9
9
|
"library",
|
10
10
|
"rubjs"
|
11
11
|
],
|
12
|
+
"homepage": "https://hadi-rostami.github.io/rubjs-docs/",
|
13
|
+
"repository": {
|
14
|
+
"type": "git",
|
15
|
+
"url": "https://github.com/hadi-rostami/rubjs"
|
16
|
+
},
|
12
17
|
"module": "./lib/index.js",
|
13
18
|
"exports": {
|
14
19
|
"import": "./lib/index.js",
|
@@ -28,7 +33,7 @@
|
|
28
33
|
"axios": "^1.11.0",
|
29
34
|
"fastify": "^5.4.0",
|
30
35
|
"json-bigint": "^1.0.0",
|
31
|
-
"localtunnel": "
|
36
|
+
"localtunnel": "npm:@security-patched/localtunnel@^2.0.2-secpatched.5",
|
32
37
|
"node-rsa": "^1.1.1",
|
33
38
|
"optional-require": "^2.0.1",
|
34
39
|
"undici": "^7.10.0",
|