Removed most Telegram library log messages (#4650)
Ylian Saint-Hilaire committed
Oct 22, 2022 at 15:26 UTC
a94d7fa2332eed3493cf818e6334885ef2f64ef2
1 file changed
+4
-7
meshmessaging.js
+4
-7
@@ -48,12 +48,8 @@ module.exports.CreateServer = function (parent) {
48
const input = require('input');
49
const stringSession = new StringSession(parent.config.messaging.telegram.session);
50
const client = new TelegramClient(stringSession, parent.config.messaging.telegram.apiid, parent.config.messaging.telegram.apihash, { connectionRetries: 5 });
51
- await client.start({
52
- phoneNumber: async function () { await input.text("Please enter your number: "); },
53
- password: async function () { await input.text("Please enter your password: "); },
54
- phoneCode: async function () { await input.text("Please enter the code you received: "); },
55
- onError: function (err) { console.log('Telegram error', err); },
56
- });
51
+ client.setLogLevel('none');
52
+ await client.start({ onError: function (err) { console.log('Telegram error', err); } });
53
obj.telegramClient = client;
54
obj.providers += 1; // Enable Telegram messaging
55
console.log("MeshCentral Telegram client is connected.");
@@ -177,7 +173,8 @@ module.exports.SetupTelegram = async function (parent) {
173
const { StringSession } = require('telegram/sessions');
174
const input = require('input');
175
const stringSession = new StringSession('');
180
- const client = new TelegramClient(stringSession, parent.config.messaging.telegram.apiid, parent.config.messaging.telegram.apihash, { connectionRetries: 5 });
176
+ const client = new TelegramClient(stringSession, parent.config.messaging.telegram.apiid, parent.config.messaging.telegram.apihash, { connectionRetries: 5, logLevel: 'none' });
177
+ client.setLogLevel('none');
178
await client.start({
179
phoneNumber: async function () { return await input.text("Please enter your number (+1-111-222-3333): "); },
180
password: async function () { return await input.text("Please enter your password: "); },