create-gramstax 0.8.7 → 0.8.8
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/guards/user.ts +1 -1
- package/dist/src/templates/src/pages/general-status.ts +5 -5
- package/dist/src/templates/src/pages/help.ts +10 -6
- package/dist/src/templates/src/pages/random-number.ts +12 -8
- package/dist/src/templates/src/pages/start.ts +12 -8
- package/dist/src/templates/src/pages/username-notfound.ts +10 -6
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export class UserGuard extends GuardBase {
|
|
|
11
11
|
async ensureUsername(edit: boolean) {
|
|
12
12
|
try {
|
|
13
13
|
if (!this.userName || this.userName.length == 0) {
|
|
14
|
-
await new UserNameNotFoundPage(this).
|
|
14
|
+
await new UserNameNotFoundPage(this).showStep1Form(edit)
|
|
15
15
|
return null
|
|
16
16
|
}
|
|
17
17
|
return {status: true}
|
|
@@ -3,12 +3,12 @@ import {PageBase} from "~/base/page"
|
|
|
3
3
|
import {StartPage} from "./start"
|
|
4
4
|
|
|
5
5
|
class Base {
|
|
6
|
-
static
|
|
6
|
+
static dynamic = `d`
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
class Helper {
|
|
10
10
|
static kb(ctx: GeneralStatusPage) {
|
|
11
|
-
const bi = Base.
|
|
11
|
+
const bi = Base.dynamic
|
|
12
12
|
const kb = ctx.inlineKeyboardT([StartPage], `1`, bi)
|
|
13
13
|
return kb
|
|
14
14
|
}
|
|
@@ -19,7 +19,7 @@ class Alert {
|
|
|
19
19
|
LogHe.errorMake(error, ctx.constructorName, funcName)
|
|
20
20
|
|
|
21
21
|
await ctx.clearSession()
|
|
22
|
-
const bi = Base.
|
|
22
|
+
const bi = Base.dynamic
|
|
23
23
|
const kb = Helper.kb(ctx)
|
|
24
24
|
const da = {isNotFound: false}
|
|
25
25
|
if (edit) {
|
|
@@ -30,7 +30,7 @@ class Alert {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
static async showErrorInputNotFound(ctx: GeneralStatusPage) {
|
|
33
|
-
const bi = Base.
|
|
33
|
+
const bi = Base.dynamic
|
|
34
34
|
const kb = Helper.kb(ctx)
|
|
35
35
|
const da = {isNotFound: true}
|
|
36
36
|
await ctx.reply(kb, da, bi)
|
|
@@ -54,7 +54,7 @@ export class GeneralStatusPage extends PageBase {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
static template = `
|
|
57
|
-
<base id="${Base.
|
|
57
|
+
<base id="${Base.dynamic}">
|
|
58
58
|
${this.kbk.home()}
|
|
59
59
|
<message>
|
|
60
60
|
<b>{~isNotFound ? "🔎 Route Not Found" : "❌ Error Occurred"~}</b>
|
|
@@ -2,12 +2,12 @@ import {PageBase} from "~/base/page"
|
|
|
2
2
|
import {StartPage} from "./start"
|
|
3
3
|
|
|
4
4
|
class Base {
|
|
5
|
-
static
|
|
5
|
+
static step1 = `s1`
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
class Main {
|
|
9
|
-
static async
|
|
10
|
-
const bi = Base.
|
|
9
|
+
static async showStep1Form(ctx: HelpPage, edit = true) {
|
|
10
|
+
const bi = Base.step1
|
|
11
11
|
const kb = ctx.inlineKeyboardT([StartPage], `1`, bi)
|
|
12
12
|
const da = {}
|
|
13
13
|
if (edit) {
|
|
@@ -16,19 +16,23 @@ class Main {
|
|
|
16
16
|
await ctx.reply(kb, da, bi)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
static async processStep1Answer(ctx: HelpPage) {
|
|
21
|
+
throw ctx
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export class HelpPage extends PageBase {
|
|
22
26
|
async handleCallbackData() {
|
|
23
|
-
await Main.
|
|
27
|
+
await Main.showStep1Form(this, true)
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
async handleCommandText() {
|
|
27
|
-
await Main.
|
|
31
|
+
await Main.showStep1Form(this, false)
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
static template = `
|
|
31
|
-
<base id="${Base.
|
|
35
|
+
<base id="${Base.step1}">
|
|
32
36
|
${this.kbk.back()}
|
|
33
37
|
<message>
|
|
34
38
|
<b>🆘 Help Message</b>
|
|
@@ -2,12 +2,12 @@ import {PageBase} from "~/base/page"
|
|
|
2
2
|
import {StartPage} from "./start"
|
|
3
3
|
|
|
4
4
|
class Base {
|
|
5
|
-
static
|
|
5
|
+
static step1 = `s1`
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
class Main {
|
|
9
|
-
static async
|
|
10
|
-
const bi = Base.
|
|
9
|
+
static async showStep1Form(ctx: RandomNumberPage, edit = true) {
|
|
10
|
+
const bi = Base.step1
|
|
11
11
|
const kb = ctx.inlineKeyboardT([ctx, StartPage], `1`, bi)
|
|
12
12
|
const da = {result: Math.random() * 10 ** 18}
|
|
13
13
|
if (edit) {
|
|
@@ -16,23 +16,27 @@ class Main {
|
|
|
16
16
|
await ctx.reply(kb, da, bi)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
static async processStep1Answer(ctx: RandomNumberPage) {
|
|
21
|
+
throw ctx
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export class RandomNumberPage extends PageBase {
|
|
22
26
|
async handleCallbackData() {
|
|
23
|
-
await Main.
|
|
27
|
+
await Main.showStep1Form(this, true)
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
async handleCommandText() {
|
|
27
|
-
await Main.
|
|
31
|
+
await Main.showStep1Form(this, false)
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
async
|
|
31
|
-
await Main.
|
|
34
|
+
async showStep1Form(edit = true) {
|
|
35
|
+
await Main.showStep1Form(this, edit)
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
static template = `
|
|
35
|
-
<base id="${Base.
|
|
39
|
+
<base id="${Base.step1}">
|
|
36
40
|
<keyboard>🎲 Shake, ${this.kbl.back.default}</keyboard>
|
|
37
41
|
<keyboard lang="id">🎲 Kocok, ${this.kbl.back.id}</keyboard>
|
|
38
42
|
<message>
|
|
@@ -4,13 +4,13 @@ import {RandomNumberPage} from "./random-number"
|
|
|
4
4
|
import {SumNumberPage} from "./sum-number"
|
|
5
5
|
|
|
6
6
|
class Base {
|
|
7
|
-
static
|
|
7
|
+
static step1 = `s1`
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
class Main {
|
|
11
|
-
static async
|
|
11
|
+
static async showStep1Form(ctx: StartPage, edit = true) {
|
|
12
12
|
await ctx.clearSession()
|
|
13
|
-
const bi = Base.
|
|
13
|
+
const bi = Base.step1
|
|
14
14
|
const kb = ctx.inlineKeyboardT([RandomNumberPage, SumNumberPage, HelpPage], `2`, bi)
|
|
15
15
|
const da = {userName: ctx.userName}
|
|
16
16
|
if (edit) {
|
|
@@ -19,23 +19,27 @@ class Main {
|
|
|
19
19
|
await ctx.reply(kb, da, bi)
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
static async processStep1Answer(ctx: StartPage) {
|
|
24
|
+
throw ctx
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
export class StartPage extends PageBase {
|
|
25
29
|
async handleCallbackData() {
|
|
26
|
-
await Main.
|
|
30
|
+
await Main.showStep1Form(this, true)
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
async handleCommandText() {
|
|
30
|
-
await Main.
|
|
34
|
+
await Main.showStep1Form(this, false)
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
async
|
|
34
|
-
await Main.
|
|
37
|
+
async showStep1Form(edit = true) {
|
|
38
|
+
await Main.showStep1Form(this, edit)
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
static template = `
|
|
38
|
-
<base id="${Base.
|
|
42
|
+
<base id="${Base.step1}">
|
|
39
43
|
<keyboard>🎰 Random Number, ➕ Sum Number, 🆘 Help</keyboard>
|
|
40
44
|
<keyboard lang="id">🎰 Angka Acak, ➕ Jumlah Angka, 🆘 Bantuan</keyboard>
|
|
41
45
|
<message>
|
|
@@ -2,12 +2,12 @@ import {HelpPage} from "./help"
|
|
|
2
2
|
import {PageBase} from "~/base/page"
|
|
3
3
|
|
|
4
4
|
class Base {
|
|
5
|
-
static
|
|
5
|
+
static step1 = `s1`
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
class Main {
|
|
9
|
-
static async
|
|
10
|
-
const bi = Base.
|
|
9
|
+
static async showStep1Form(ctx: UserNameNotFoundPage, edit = true) {
|
|
10
|
+
const bi = Base.step1
|
|
11
11
|
const kb = ctx.inlineKeyboardT([HelpPage], `1`, bi)
|
|
12
12
|
const da = {}
|
|
13
13
|
if (edit) {
|
|
@@ -16,15 +16,19 @@ class Main {
|
|
|
16
16
|
await ctx.reply(kb, da, bi)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
static async processStep1Answer(ctx: UserNameNotFoundPage) {
|
|
21
|
+
throw ctx
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export class UserNameNotFoundPage extends PageBase {
|
|
22
|
-
async
|
|
23
|
-
await Main.
|
|
26
|
+
async showStep1Form(edit = true) {
|
|
27
|
+
await Main.showStep1Form(this, edit)
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
static template = `
|
|
27
|
-
<base id="${Base.
|
|
31
|
+
<base id="${Base.step1}">
|
|
28
32
|
${this.kbk.home()}
|
|
29
33
|
<message>
|
|
30
34
|
<b>⚠️ Username Required</b>
|