@alemonjs/telegram 0.2.2 → 0.2.3
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/lib/index.d.ts +9 -0
- package/lib/index.js +7 -3
- package/package.json +10 -9
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as alemonjs from 'alemonjs';
|
|
2
|
+
import TelegramClient from 'node-telegram-bot-api';
|
|
3
|
+
|
|
4
|
+
type Client = typeof TelegramClient.prototype;
|
|
5
|
+
declare const client: Client;
|
|
6
|
+
declare const platform = "telegram";
|
|
7
|
+
declare const _default: () => alemonjs.ClientAPI;
|
|
8
|
+
|
|
9
|
+
export { type Client, client, _default as default, platform };
|
package/lib/index.js
CHANGED
|
@@ -13,7 +13,9 @@ const client = new Proxy({}, {
|
|
|
13
13
|
});
|
|
14
14
|
const platform = 'telegram';
|
|
15
15
|
var index = defineBot(() => {
|
|
16
|
-
|
|
16
|
+
let value = getConfigValue();
|
|
17
|
+
if (!value)
|
|
18
|
+
value = {};
|
|
17
19
|
const config = value[platform];
|
|
18
20
|
const client = new TelegramClient(config.token, {
|
|
19
21
|
polling: true,
|
|
@@ -132,6 +134,7 @@ var index = defineBot(() => {
|
|
|
132
134
|
else if (event?.chat.type == 'private') {
|
|
133
135
|
// 定义消
|
|
134
136
|
const e = {
|
|
137
|
+
name: 'private.message.create',
|
|
135
138
|
// 事件类型
|
|
136
139
|
Platform: platform,
|
|
137
140
|
// 用户Id
|
|
@@ -196,6 +199,7 @@ var index = defineBot(() => {
|
|
|
196
199
|
};
|
|
197
200
|
// 定义消
|
|
198
201
|
const e = {
|
|
202
|
+
naem: 'member.add',
|
|
199
203
|
// 事件类型
|
|
200
204
|
Platform: platform,
|
|
201
205
|
// guild
|
|
@@ -211,8 +215,8 @@ var index = defineBot(() => {
|
|
|
211
215
|
IsBot: false,
|
|
212
216
|
// message
|
|
213
217
|
MessageId: String(event?.message_id),
|
|
214
|
-
MessageText: event?.text,
|
|
215
|
-
OpenId: String(event?.chat?.id),
|
|
218
|
+
// MessageText: event?.text,
|
|
219
|
+
// OpenId: String(event?.chat?.id),
|
|
216
220
|
CreateAt: Date.now(),
|
|
217
221
|
// othder
|
|
218
222
|
tag: 'txt',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alemonjs/telegram",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "telegram-bot",
|
|
5
5
|
"author": "lemonade",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,14 +14,6 @@
|
|
|
14
14
|
"grammy": "^1.30.0",
|
|
15
15
|
"node-telegram-bot-api": "^0.66.0"
|
|
16
16
|
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
19
|
-
"lvyjs": "^0.2.13",
|
|
20
|
-
"rollup": "^4.18.1",
|
|
21
|
-
"rollup-plugin-dts": "^6.1.1",
|
|
22
|
-
"tsx": "^4.19.1",
|
|
23
|
-
"@types/node-telegram-bot-api": "^0.64.7"
|
|
24
|
-
},
|
|
25
17
|
"exports": {
|
|
26
18
|
".": {
|
|
27
19
|
"import": "./lib/index.js",
|
|
@@ -29,6 +21,15 @@
|
|
|
29
21
|
},
|
|
30
22
|
"./package": "./package.json"
|
|
31
23
|
},
|
|
24
|
+
"alemonjs": {
|
|
25
|
+
"desktop": {
|
|
26
|
+
"platform": [
|
|
27
|
+
{
|
|
28
|
+
"name": "telegram"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
32
33
|
"keywords": [
|
|
33
34
|
"alemonjs"
|
|
34
35
|
],
|