create-gramstax 0.3.22 → 0.4.1

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.
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "logging-pretty": "^3.0.0",
39
- "gramstax": "^0.3.21"
39
+ "gramstax": "^0.4.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "typescript": "5.9.3"
@@ -1,7 +1,7 @@
1
- import {KeyboardComponent} from "~/components/keyboard"
1
+ import {KeyboardBlock} from "~/blocks/keyboard"
2
2
  import {CtxCore} from "~/core/ctx"
3
3
 
4
4
  export abstract class PageBase extends CtxCore {
5
- static kbc = KeyboardComponent
6
- static kbd = KeyboardComponent.data
5
+ static kbk = KeyboardBlock
6
+ static kbl = KeyboardBlock.label
7
7
  }
@@ -1,8 +1,8 @@
1
- import {KeyboardData} from "~/data/keyboard"
2
- import {ComponentKeyboard} from "gramstax"
1
+ import {BlockKeyboard} from "gramstax"
2
+ import {KeyboardLabel} from "~/labels/keyboard"
3
3
 
4
- export class KeyboardComponent extends ComponentKeyboard {
5
- static data = KeyboardData
4
+ export class KeyboardBlock extends BlockKeyboard {
5
+ static label = KeyboardLabel
6
6
  static home(lang?: string, type?: string) {
7
7
  return this._build(`home`, lang, type)
8
8
  }
@@ -1,6 +1,6 @@
1
- import {DataKeyboard} from "gramstax"
1
+ import {LabelKeyboard} from "gramstax"
2
2
 
3
- export class KeyboardData extends DataKeyboard {
3
+ export class KeyboardLabel extends LabelKeyboard {
4
4
  static home(lang?: string) {
5
5
  return this._build(lang, false, {
6
6
  default: `Home`,
@@ -10,7 +10,7 @@ export class GeneralStatusPage extends PageBase {
10
10
  }
11
11
 
12
12
  kb() {
13
- return this.ikb((k, a) => {
13
+ return this.inlineKeyboard((k, a) => {
14
14
  return k.text(a[0]!, StartPage.data.callback())
15
15
  })
16
16
  }
@@ -34,7 +34,7 @@ export class GeneralStatusPage extends PageBase {
34
34
 
35
35
  static template = `
36
36
  <base>
37
- ${this.kbc.home()}
37
+ ${this.kbk.home()}
38
38
  </base>
39
39
 
40
40
  <base id="error">
@@ -3,31 +3,28 @@ import {StartPage} from "./start"
3
3
 
4
4
  export class HelpPage extends PageBase {
5
5
  kb() {
6
- return this.ikb((k, a) => {
6
+ return this.inlineKeyboard((k, a) => {
7
7
  return k.text(a[0]!, StartPage.data.callback())
8
8
  })
9
9
  }
10
10
 
11
- async internal(edit = true) {
11
+ async core(edit = true) {
12
12
  const kb = this.kb()
13
- if (edit) {
14
- await this.edit(kb)
15
- } else {
16
- await this.reply(kb)
17
- }
13
+ if (edit) await this.edit(kb)
14
+ else await this.reply(kb)
18
15
  }
19
16
 
20
17
  async callback() {
21
- await this.internal(true)
18
+ await this.core(true)
22
19
  }
23
20
 
24
21
  async textCommand() {
25
- await this.internal(false)
22
+ await this.core(false)
26
23
  }
27
24
 
28
25
  static template = `
29
26
  <base>
30
- ${this.kbc.back()}
27
+ ${this.kbk.back()}
31
28
  <message><b>Help message</b></message>
32
29
  <message lang="it"><b>Ordina aiuto</b></message>
33
30
  <message lang="id"><b>Pesan bantuan</b></message>
@@ -8,7 +8,7 @@ export class InputTextPage extends PageBase {
8
8
  })
9
9
 
10
10
  kb(baseId?: string) {
11
- return this.ikb((k, a) => {
11
+ return this.inlineKeyboard((k, a) => {
12
12
  return k.text(a[0]!, StartPage.data.callback()), {baseId}
13
13
  })
14
14
  }
@@ -44,13 +44,13 @@ export class InputTextPage extends PageBase {
44
44
 
45
45
  static template = `
46
46
  <base>
47
- ${this.kbc.cancel()}
47
+ ${this.kbk.cancel()}
48
48
  <message>Please input text you want view</message>
49
49
  <message lang="it">Inserisci il testo che vuoi vedere</message>
50
50
  <message lang="id">Tolong masukan text yang ingin anda liat</message>
51
51
  </base>
52
52
  <base id="result">
53
- ${this.kbc.home()}
53
+ ${this.kbk.home()}
54
54
  <message>
55
55
  Result: {{res}}
56
56
 
@@ -3,27 +3,24 @@ import {PageBase} from "~/base/page"
3
3
 
4
4
  export class StartPage extends PageBase {
5
5
  kb() {
6
- return this.ikb((k, a) => {
6
+ return this.inlineKeyboard((k, a) => {
7
7
  return k.text(a[0]!, HelpPage.data.callback())
8
8
  })
9
9
  }
10
10
 
11
- async internal(edit = true) {
11
+ async core(edit = true) {
12
12
  const kb = this.kb()
13
13
  const data = {userName: this.userName}
14
- if (edit) {
15
- await this.edit(kb, data)
16
- } else {
17
- await this.reply(kb, data)
18
- }
14
+ if (edit) await this.edit(kb, data)
15
+ else await this.reply(kb, data)
19
16
  }
20
17
 
21
18
  async callback() {
22
- await this.internal(true)
19
+ await this.core(true)
23
20
  }
24
21
 
25
22
  async textCommand() {
26
- await this.internal(false)
23
+ await this.core(false)
27
24
  }
28
25
 
29
26
  static template = `
@@ -3,23 +3,20 @@ import {PageBase} from "~/base/page"
3
3
 
4
4
  export class UserNameNotFoundPage extends PageBase {
5
5
  kb() {
6
- return this.ikb((k, a) => {
6
+ return this.inlineKeyboard((k, a) => {
7
7
  return k.text(a[0]!, HelpPage.data.callback())
8
8
  })
9
9
  }
10
10
 
11
11
  async transition(edit = true) {
12
12
  const kb = this.kb()
13
- if (edit) {
14
- await this.edit(kb)
15
- } else {
16
- await this.reply(kb)
17
- }
13
+ if (edit) await this.edit(kb)
14
+ else await this.reply(kb)
18
15
  }
19
16
 
20
17
  static template = `
21
18
  <base>
22
- ${this.kbc.home()}
19
+ ${this.kbk.home()}
23
20
  <message>Please set the username first before using the bot.</message>
24
21
  <message lang="it">Prima di utilizzare il bot, imposta prima il nome utente.</message>
25
22
  <message lang="id">Tolong set username dulu sebelum memakai bot</message>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-gramstax",
3
- "version": "0.3.22",
3
+ "version": "0.4.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",