@mikitasazan/notify 1.4.0 → 1.4.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 +22 -16
- package/dist/cli-flags.js +3 -2
- package/dist/cli.js +70 -29
- package/dist/events.d.ts +132 -27
- package/dist/events.js +77 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/render.d.ts +10 -1
- package/dist/render.js +198 -80
- package/dist/routes.js +1 -1
- package/dist/send.js +21 -19
- package/dist/setup.js +9 -9
- package/package.json +1 -1
package/dist/setup.js
CHANGED
|
@@ -23,21 +23,21 @@ const createTopic = async (token, chat, name, color) => {
|
|
|
23
23
|
});
|
|
24
24
|
const body = (await res.json());
|
|
25
25
|
if (!body.ok || !body.result) {
|
|
26
|
-
log(
|
|
26
|
+
log(`could not create "${name}": ${body.description ?? `HTTP ${res.status}`}`);
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
return body.result.message_thread_id;
|
|
30
30
|
}
|
|
31
31
|
catch (err) {
|
|
32
32
|
// Сеть/таймаут/нечитаемый ответ — не роняем CLI (его контракт: всегда exit 0).
|
|
33
|
-
log(
|
|
33
|
+
log(`could not create "${name}": ${err instanceof Error ? err.message : String(err)}`);
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
export const setupTopic = async (chatId, projectKey) => {
|
|
38
38
|
const token = process.env.OPS_BOT_TOKEN?.trim();
|
|
39
39
|
if (!token) {
|
|
40
|
-
log('
|
|
40
|
+
log('no OPS_BOT_TOKEN — cannot create the tabs');
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
const ops = await createTopic(token, chatId, '⚙️ Ops', 9367192);
|
|
@@ -45,16 +45,16 @@ export const setupTopic = async (chatId, projectKey) => {
|
|
|
45
45
|
// Частичный успех: если создался только Ops — печатаем его, иначе повторный
|
|
46
46
|
// запуск создал бы ДРУГУЮ тему Ops, а старый id потерялся бы.
|
|
47
47
|
if (ops === null) {
|
|
48
|
-
log('Ops
|
|
48
|
+
log('Ops was not created — check: is the bot a group admin with "Manage topics", and are topics on?');
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
if (dev === null) {
|
|
52
|
-
log(`Ops
|
|
53
|
-
log('
|
|
54
|
-
log(` ${JSON.stringify(projectKey)}: { chat: '${chatId}', ops: ${ops}, dev:
|
|
52
|
+
log(`Ops created (id=${ops}), Dev was not — add Dev by hand or run again, and keep ops=${ops}`);
|
|
53
|
+
log('add to src/routes.ts (fill dev in afterwards):');
|
|
54
|
+
log(` ${JSON.stringify(projectKey)}: { chat: '${chatId}', ops: ${ops}, dev: <fill in> },`);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
log(
|
|
58
|
-
log('
|
|
57
|
+
log(`tabs created: Ops=${ops}, Dev=${dev}`);
|
|
58
|
+
log('add to src/routes.ts:');
|
|
59
59
|
log(` ${JSON.stringify(projectKey)}: { chat: '${chatId}', ops: ${ops}, dev: ${dev} },`);
|
|
60
60
|
};
|
package/package.json
CHANGED