supertelegram 0.1.2 → 0.1.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/README.md +2 -2
- package/package.json +1 -1
- package/src/cli/commands.ts +5 -5
- package/src/cli/run.ts +4 -4
package/README.md
CHANGED
package/package.json
CHANGED
package/src/cli/commands.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { askPhoneNumber, askPhoneCode, askPassword } from "./prompts";
|
|
|
11
11
|
|
|
12
12
|
export async function send(username: string, message: string) {
|
|
13
13
|
if (!(await isLoggedIn())) {
|
|
14
|
-
console.error("not logged in. run:
|
|
14
|
+
console.error("not logged in. run: telegram login");
|
|
15
15
|
process.exit(1);
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -22,7 +22,7 @@ export async function send(username: string, message: string) {
|
|
|
22
22
|
|
|
23
23
|
export async function read(username: string, limit = 10) {
|
|
24
24
|
if (!(await isLoggedIn())) {
|
|
25
|
-
console.error("not logged in. run:
|
|
25
|
+
console.error("not logged in. run: telegram login");
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -37,7 +37,7 @@ export async function read(username: string, limit = 10) {
|
|
|
37
37
|
|
|
38
38
|
export async function dialogs(limit = 10) {
|
|
39
39
|
if (!(await isLoggedIn())) {
|
|
40
|
-
console.error("not logged in. run:
|
|
40
|
+
console.error("not logged in. run: telegram login");
|
|
41
41
|
process.exit(1);
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -50,7 +50,7 @@ export async function dialogs(limit = 10) {
|
|
|
50
50
|
|
|
51
51
|
export async function unread(limit = 20) {
|
|
52
52
|
if (!(await isLoggedIn())) {
|
|
53
|
-
console.error("not logged in. run:
|
|
53
|
+
console.error("not logged in. run: telegram login");
|
|
54
54
|
process.exit(1);
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -98,7 +98,7 @@ export async function unread(limit = 20) {
|
|
|
98
98
|
|
|
99
99
|
export async function reply(chatName: string, message: string) {
|
|
100
100
|
if (!(await isLoggedIn())) {
|
|
101
|
-
console.error("not logged in. run:
|
|
101
|
+
console.error("not logged in. run: telegram login");
|
|
102
102
|
process.exit(1);
|
|
103
103
|
}
|
|
104
104
|
|
package/src/cli/run.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { send, read, dialogs, unread, reply, login } from "./commands";
|
|
|
3
3
|
import { setVerbose } from "../client/telegram";
|
|
4
4
|
|
|
5
5
|
const VERSION = "0.1.0";
|
|
6
|
-
const NAME = "
|
|
6
|
+
const NAME = "telegram";
|
|
7
7
|
|
|
8
8
|
const HELP = `
|
|
9
9
|
${NAME} - telegram cli for humans and bots
|
|
@@ -57,7 +57,7 @@ async function main() {
|
|
|
57
57
|
switch (command) {
|
|
58
58
|
case "send":
|
|
59
59
|
if (rest.length < 2) {
|
|
60
|
-
console.error("usage:
|
|
60
|
+
console.error("usage: telegram send <chat> <message>");
|
|
61
61
|
process.exit(1);
|
|
62
62
|
}
|
|
63
63
|
await send(rest[0], rest.slice(1).join(" "));
|
|
@@ -65,7 +65,7 @@ async function main() {
|
|
|
65
65
|
|
|
66
66
|
case "read":
|
|
67
67
|
if (rest.length < 1) {
|
|
68
|
-
console.error("usage:
|
|
68
|
+
console.error("usage: telegram read <chat> [limit]");
|
|
69
69
|
process.exit(1);
|
|
70
70
|
}
|
|
71
71
|
await read(rest[0], rest[1] ? Number.parseInt(rest[1]) : 10);
|
|
@@ -81,7 +81,7 @@ async function main() {
|
|
|
81
81
|
|
|
82
82
|
case "reply":
|
|
83
83
|
if (rest.length < 2) {
|
|
84
|
-
console.error("usage:
|
|
84
|
+
console.error("usage: telegram reply <chat> <message>");
|
|
85
85
|
process.exit(1);
|
|
86
86
|
}
|
|
87
87
|
await reply(rest[0], rest.slice(1).join(" "));
|