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.
@@ -35,7 +35,7 @@
35
35
  "lint:fix": "eslint . --fix"
36
36
  },
37
37
  "dependencies": {
38
- "gramstax": "^0.8.6",
38
+ "gramstax": "^0.8.7",
39
39
  "dayjs": "^1.11.13"
40
40
  },
41
41
  "peerDependencies": {
@@ -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).showIndex(edit)
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 index = `-`
6
+ static dynamic = `d`
7
7
  }
8
8
 
9
9
  class Helper {
10
10
  static kb(ctx: GeneralStatusPage) {
11
- const bi = Base.index
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.index
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.index
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.index}">
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 index = `-`
5
+ static step1 = `s1`
6
6
  }
7
7
 
8
8
  class Main {
9
- static async showIndex(ctx: HelpPage, edit = true) {
10
- const bi = Base.index
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.showIndex(this, true)
27
+ await Main.showStep1Form(this, true)
24
28
  }
25
29
 
26
30
  async handleCommandText() {
27
- await Main.showIndex(this, false)
31
+ await Main.showStep1Form(this, false)
28
32
  }
29
33
 
30
34
  static template = `
31
- <base id="${Base.index}">
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 index = `-`
5
+ static step1 = `s1`
6
6
  }
7
7
 
8
8
  class Main {
9
- static async showIndex(ctx: RandomNumberPage, edit = true) {
10
- const bi = Base.index
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.showIndex(this, true)
27
+ await Main.showStep1Form(this, true)
24
28
  }
25
29
 
26
30
  async handleCommandText() {
27
- await Main.showIndex(this, false)
31
+ await Main.showStep1Form(this, false)
28
32
  }
29
33
 
30
- async showIndex(edit = true) {
31
- await Main.showIndex(this, edit)
34
+ async showStep1Form(edit = true) {
35
+ await Main.showStep1Form(this, edit)
32
36
  }
33
37
 
34
38
  static template = `
35
- <base id="${Base.index}">
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 index = `-`
7
+ static step1 = `s1`
8
8
  }
9
9
 
10
10
  class Main {
11
- static async showIndex(ctx: StartPage, edit = true) {
11
+ static async showStep1Form(ctx: StartPage, edit = true) {
12
12
  await ctx.clearSession()
13
- const bi = Base.index
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.showIndex(this, true)
30
+ await Main.showStep1Form(this, true)
27
31
  }
28
32
 
29
33
  async handleCommandText() {
30
- await Main.showIndex(this, false)
34
+ await Main.showStep1Form(this, false)
31
35
  }
32
36
 
33
- async showIndex(edit = true) {
34
- await Main.showIndex(this, edit)
37
+ async showStep1Form(edit = true) {
38
+ await Main.showStep1Form(this, edit)
35
39
  }
36
40
 
37
41
  static template = `
38
- <base id="${Base.index}">
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 index = `-`
5
+ static step1 = `s1`
6
6
  }
7
7
 
8
8
  class Main {
9
- static async showIndex(ctx: UserNameNotFoundPage, edit = true) {
10
- const bi = Base.index
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 showIndex(edit = true) {
23
- await Main.showIndex(this, edit)
26
+ async showStep1Form(edit = true) {
27
+ await Main.showStep1Form(this, edit)
24
28
  }
25
29
 
26
30
  static template = `
27
- <base id="${Base.index}">
31
+ <base id="${Base.step1}">
28
32
  ${this.kbk.home()}
29
33
  <message>
30
34
  <b>⚠️ Username Required</b>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gramstax",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",