2 次代碼提交 7172e9a1ed ... c9a92388fc

作者 SHA1 備註 提交日期
  Parad0x c9a92388fc - README.md updated with build section 6 年之前
  Parad0x 7172e9a1ed - README.md updated with build section 6 年之前
共有 2 個文件被更改,包括 9 次插入5 次删除
  1. 6 2
      src/bot/app.ts
  2. 3 3
      src/bot/auth.ts

+ 6 - 2
src/bot/app.ts

@@ -67,7 +67,7 @@ function app() {
         throw new Error(`There is no app with id equeal ${id}`);
       }
       await app.update({
-        activated: true
+        isActivated: true
       })
       ctx.editMessageText(`[${app.name}] Activated`, await getPAppsKeyboard());
     } catch (e) {
@@ -115,6 +115,10 @@ function app() {
         throw new Error("There is no state attribute");
       }
       const args: string = await ctx.state.command.args;
+      if (args.length <= 0) {
+        ctx.reply("You need to spiecifie name");
+        return;
+      }
       if (args.length > 25) {
         ctx.reply("Name to long!");
         return;
@@ -122,7 +126,7 @@ function app() {
       const appName = args;
       const instance = await db.App.create({
         name: appName,
-        activated: true
+        isActivated: true
       });
       ctx.reply(`App registered\n` +
         `Name: ${instance.name}\n` +

+ 3 - 3
src/bot/auth.ts

@@ -65,14 +65,14 @@ function auth(): void {
       if (args === actualAuthCode) {
         if (ctx.user) {
           await ctx.user.update({
-            activated: true
+            isAuthenticated: true
           });
         } else {
           let user = await db.User.findOrCreate({
             where: {
               userTelegramId: ctx.from.id
             }, defaults: {
-              activated: true
+              isAuthenticated: true
             }
           });
         }
@@ -81,7 +81,7 @@ function auth(): void {
       } else {
         let user = await db.User.create({
           userTelegramId: ctx.from.id,
-          activated: false
+          isAuthenticated: false
         });
         ctx.reply("Wrong authentication code. Will be banned for 24H")
       }