create-gramstax 0.5.2 → 0.5.4
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/dist/src/templates/package.json +1 -1
- package/dist/src/templates/src/index.ts +1 -1
- package/dist/src/templates/src/pages/general-status.ts +4 -9
- package/dist/src/templates/src/pages/help.ts +4 -10
- package/dist/src/templates/src/pages/input-text.ts +1 -3
- package/dist/src/templates/src/pages/start.ts +4 -10
- package/dist/src/templates/src/pages/username-notfound.ts +1 -7
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ logUt.success(`Bot started..`)
|
|
|
8
8
|
new BotCore({
|
|
9
9
|
token: env.TELEGRAM_BOT_TOKEN,
|
|
10
10
|
deploy: env.TELEGRAM_BOT_DEPLOY,
|
|
11
|
-
cacheSession: new CacheExternal(env.TELEGRAM_CACHE_SESSION,
|
|
11
|
+
cacheSession: new CacheExternal(env.TELEGRAM_CACHE_SESSION, 24 * 60 * 60 * 1000, `s`),
|
|
12
12
|
optionsPage: {
|
|
13
13
|
shortCallbackData: true
|
|
14
14
|
}
|
|
@@ -10,22 +10,17 @@ export class GeneralStatusPage extends PageBase {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
kb() {
|
|
13
|
-
return this.
|
|
14
|
-
return k.text(a[0]!, StartPage.data.callback())
|
|
15
|
-
})
|
|
13
|
+
return this.inlineKeyboardT([StartPage])
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
async toError(funcName: string, error: any,
|
|
16
|
+
async toError(funcName: string, error: any, edit = true) {
|
|
19
17
|
log.errorMake(error, this.constructorName, funcName)
|
|
20
18
|
|
|
21
19
|
await this.sessionClear()
|
|
22
20
|
const kb = this.kb()
|
|
23
21
|
const id = `error`
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
await this.reply(kb, {}, id)
|
|
28
|
-
}
|
|
22
|
+
if (edit) await this.edit(kb, {}, id)
|
|
23
|
+
else await this.reply(kb, {}, id)
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
async toErrorInputNotFound() {
|
|
@@ -2,24 +2,18 @@ import {PageBase} from "~/base/page"
|
|
|
2
2
|
import {StartPage} from "./start"
|
|
3
3
|
|
|
4
4
|
export class HelpPage extends PageBase {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return k.text(a[0]!, StartPage.data.callback())
|
|
8
|
-
})
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async core(edit = true) {
|
|
12
|
-
const kb = this.kb()
|
|
5
|
+
async show(edit = true) {
|
|
6
|
+
const kb = this.inlineKeyboardT([StartPage])
|
|
13
7
|
if (edit) await this.edit(kb)
|
|
14
8
|
else await this.reply(kb)
|
|
15
9
|
}
|
|
16
10
|
|
|
17
11
|
async callback() {
|
|
18
|
-
await this.
|
|
12
|
+
await this.show(true)
|
|
19
13
|
}
|
|
20
14
|
|
|
21
15
|
async textCommand() {
|
|
22
|
-
await this.
|
|
16
|
+
await this.show(false)
|
|
23
17
|
}
|
|
24
18
|
|
|
25
19
|
static template = `
|
|
@@ -8,9 +8,7 @@ export class InputTextPage extends PageBase {
|
|
|
8
8
|
})
|
|
9
9
|
|
|
10
10
|
kb(baseId?: string) {
|
|
11
|
-
return this.
|
|
12
|
-
return k.text(a[0]!, StartPage.data.callback()), {baseId}
|
|
13
|
-
})
|
|
11
|
+
return this.inlineKeyboardT([StartPage], `1`, baseId)
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
async callback() {
|
|
@@ -2,25 +2,19 @@ import {HelpPage} from "./help"
|
|
|
2
2
|
import {PageBase} from "~/base/page"
|
|
3
3
|
|
|
4
4
|
export class StartPage extends PageBase {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return k.text(a[0]!, HelpPage.data.callback())
|
|
8
|
-
})
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async core(edit = true) {
|
|
12
|
-
const kb = this.kb()
|
|
5
|
+
async show(edit = true) {
|
|
6
|
+
const kb = this.inlineKeyboardT([HelpPage])
|
|
13
7
|
const data = {userName: this.userName}
|
|
14
8
|
if (edit) await this.edit(kb, data)
|
|
15
9
|
else await this.reply(kb, data)
|
|
16
10
|
}
|
|
17
11
|
|
|
18
12
|
async callback() {
|
|
19
|
-
await this.
|
|
13
|
+
await this.show(true)
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
async textCommand() {
|
|
23
|
-
await this.
|
|
17
|
+
await this.show(false)
|
|
24
18
|
}
|
|
25
19
|
|
|
26
20
|
static template = `
|
|
@@ -2,14 +2,8 @@ import {HelpPage} from "./help"
|
|
|
2
2
|
import {PageBase} from "~/base/page"
|
|
3
3
|
|
|
4
4
|
export class UserNameNotFoundPage extends PageBase {
|
|
5
|
-
kb() {
|
|
6
|
-
return this.inlineKeyboard((k, a) => {
|
|
7
|
-
return k.text(a[0]!, HelpPage.data.callback())
|
|
8
|
-
})
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
async transition(edit = true) {
|
|
12
|
-
const kb = this.
|
|
6
|
+
const kb = this.inlineKeyboardT([HelpPage])
|
|
13
7
|
if (edit) await this.edit(kb)
|
|
14
8
|
else await this.reply(kb)
|
|
15
9
|
}
|