Kaynağa Gözat

- Standarized output for some operators

Parad0x 6 yıl önce
ebeveyn
işleme
d1a42c1589
1 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. 5 4
      src/connectionHandler.ts

+ 5 - 4
src/connectionHandler.ts

@@ -116,7 +116,7 @@ class Connection {
   async login() {
     const auth = await this.queue.remove();
     if (typeof this.session !== "undefined") {
-      this.write("error:session is logged;");
+      this.write("ERR;session is logged;");
       return;
     }
     const user = await db.App.findOne({
@@ -126,23 +126,24 @@ class Connection {
       }
     });
     if (!user) {
-      this.write("error:auth unmatched or not activated;");
+      this.write("ERR;auth unmatched or not activated;");
       return;
     }
     this.session = {
       user
     };
-    this.write("info:loggedin;");
+    this.write("OK;");
   }
 
   async notify() {
     const message = await this.queue.remove();
     if (typeof this.session === "undefined") {
-      this.write("error:need to be logged;");
+      this.write("ERR;need to be logged;");
       return;
     }
     let messageFormatted = `[${this.session.user.name}] - ${message}`;
     telegraf.send(messageFormatted);
+    this.write("OK;")
   }
 
   ping() {