webfast 0.1.48 → 0.1.49

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.
@@ -112,7 +112,9 @@ module.exports = {
112
112
  // Send command when wrong // or buttons like reset button
113
113
  // check what to do
114
114
  // check if stop
115
-
115
+ if (middleValue.text == `reset` || middleValue.text `stop`) {
116
+ delete program.modules.telegram.functions.que.line[chatID];
117
+ }
116
118
  return false;
117
119
  } else {
118
120
  console.log(`Matched`);
@@ -3,7 +3,12 @@
3
3
  "start" : {
4
4
  "object" : {
5
5
  "text" : "Test First Title : {{TEST}}",
6
- "image" : "{{URL}}app/content/images/block.png"
6
+ "image" : "{{URL}}app/content/images/block.png",
7
+ "buttons" : [
8
+ [
9
+ { "text": "Test Callback", "callback_data": "other" }
10
+ ]
11
+ ]
7
12
  },
8
13
  "match" : {
9
14
  "data" : [{
@@ -48,7 +48,7 @@ module.exports = async function(program,folder) {
48
48
  middleValue.chat.ts = Date.now();
49
49
  middleValue.chat.uuid = program.uuid.v4();
50
50
  let user = await program.modules.data.findOrCreate(`eventgo`,`telegram`,{
51
- id : middleValue.chat.id
51
+ id : middleValue.from.id
52
52
  },middleValue.chat);
53
53
  let typeOFF = typeof user;
54
54
  if (middleValue.chat.uuid == user.uuid || user.profileImage == undefined) {
@@ -76,7 +76,13 @@ module.exports = async function(program,folder) {
76
76
 
77
77
  try {
78
78
  // Or check if single word
79
- if (middleValue.text.startsWith('/')) {
79
+ let starts;
80
+ if (middleValue.text != undefined) {
81
+ if (middleValue.text.startsWith('/')) {
82
+ starts = true;
83
+ }
84
+ }
85
+ if (starts== true) {
80
86
  // If it starts with a slash, it might be a command
81
87
  const parts = middleValue.text.split(' ');
82
88
 
@@ -176,7 +182,20 @@ module.exports = async function(program,folder) {
176
182
 
177
183
  // TODO Catch events for middleware now just respond
178
184
  const message = `${middleValue.text}`;
179
- const command = message;
185
+ let command = message;
186
+ if (middleValue.text == undefined) {
187
+ // Check if callback or something
188
+ if (middleValue.message != undefined) {
189
+ if (middleValue.message.reply_markup != undefined) {
190
+ // Grab markup
191
+ const markupData = middleValue.message.reply_markup.inline_keyboard[0][0][`callback_data`];
192
+ // Hoppa
193
+ middleValue.text = markupData;
194
+ command = markupData;
195
+ }
196
+ }
197
+ }
198
+
180
199
  try {
181
200
  // Run dynamic the type of middleware
182
201
  const runFunc = await program.modules.telegram.middleware[key][command](req,res,body,params,command,middleValue,program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webfast",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "description": "WebFast! Bot Application, including TON mini-apps for makign it easy and fast to build ini-apps",
5
5
  "main": "index.js",
6
6
  "repository": {