recopie-moi ce code en utilisant qu'un "bot.on" EN utilisant le moins de ligne possible code !

const { TelegramBot, axios, token, error, licenses } = require("./src/config.js");
const bot = new TelegramBot(token, { polling: true });
const pool = require("./src/database.js");

const adminController = require('./controllers/adminController');
const adminPanel = require('./controllers/adminPanel');
const addStock = require('./controllers/addStock.js')



let paymentUrl = null;
bot.on("message", (msg) => {
  const chatId = msg.chat.id;
  const username = `@${msg.from.username}`;
  const userId = msg.from.id;

  if (msg.text.includes("/start")) {
    pool.query(
      `SELECT * FROM users WHERE user_id = ?`,
      [userId],
      async (err, result) => {
        if (!result.length > 0) {
          await pool.query("INSERT INTO users (user_id) VALUES (?)", [userId]);
        }
      }
    );
    pool.query(
      `SELECT * FROM users WHERE user_id = ?`,
      [userId],
      (err, results) => {
        bot.sendMessage(
          chatId,
          `Salut, ${username} que souhaitez-vous faire aujourd'hui?\n\n👤 Auto-Shop de @sendgram | Canal proof: t.me/sendgram \n\n 💳 Votre solde est actuellement de €.`,
          {
            reply_markup: {
              inline_keyboard: [
                [{ text: "🛒 Boutique", callback_data: "button1" }],
                [
                  { text: "👤 Mon compte", callback_data: "button2" },
                  { text: "💰 Recharger le compte", callback_data: "button3" },
                ],
              ],
            },
          }
        );
        })
  }
      bot.on("callback_query", (query) => {
        const chatId = query.message.chat.id;
        const messageId = query.message.message_id;
      
        if (query.data === "button1") {
          bot.editMessageText(
            "ℹ️ Choisissez le pays que vous désirez :",
            {
              chat_id: chatId,
              message_id: messageId,
              reply_markup: {
                inline_keyboard: [
                  [
                    { text: "BOUTIQUE 1", callback_data: "license1" },
                    { text: "🇩🇪 Log Amazon", callback_data: "license3" },
                  ],
                  [
                    { text: "🇧🇪 Zalando", callback_data: "license6" },
                    { text: "🇨🇭 Suisse", callback_data: "license12" },
                  ],
                  [{ text: "🇭🇺 Hongrie", callback_data: "lifetime" }],
                  [{ text: "🛒  Version d'essai", callback_data: "soon" }],
                  [{ text: "⬅️ Retour", callback_data: "back" }],
                ],
              },
            }
          );
        } 
         else if (query.data === "license1") {
          bot.editMessageText(
            "ℹ️ Vous avez choisi la France. Êtes-vous sûr(e) de votre choix ?",
            {
              chat_id: chatId,
              message_id: messageId,
              reply_markup: {
                inline_keyboard: [
                  [
                    { text: "✅ Valider", callback_data: "valider1" },
                    { text: "❌ Annuler", callback_data: "back" },
                  ],
                ],
              },
            }
          );
        } else if (query.data === "valider1") {
          pool.query(
            `SELECT * FROM users WHERE user_id = ?`,
            [query.from.id],
            async (err, results) => {
              if (results[0].balance < 10) {
                bot.editMessageText(
                  chatId,
                  `❌ Désolé(e), mais vous n'avez pas suffisamment de fonds pour effectuer cette fonctionnalité`
                );
              } else {
                const randomIndex = Math.floor(
                  Math.random() * licenses.licenses1month.length
                );
                const randomColor = licenses.licenses1month[randomIndex];
      
                licenses.licenses1month.splice(randomIndex, 1);
      
                fs.writeFileSync("./licenses.json", JSON.stringify(licenses));
      
                bot.editMessageText(
                  chatId,
                  `✅ Votre achat a été validé. \n\n\ Votre license: ${randomColor}.`
                );
                await pool.query(
                  "UPDATE users SET balance = balance - ? WHERE user_id = ?",
                  [10, query.from.id]
                );
              }
            }
          );
        } 
        else if (query.data === "button2") {
          const username = query.from.username;
          const userId = query.from.id;
          pool.query(
            `SELECT * FROM users WHERE user_id = ?`,
            [userId],
            (err, results) => {
              bot.editMessageText(
                `👤 Utilisateur: ${username} \n\ \n\ 🆔 ${results[0].user_id} \n \n 💼 Solde : ${results[0].balance} €`,
                {
                  chat_id: query.message.chat.id,
                  message_id: query.message.message_id,
                  reply_markup: {
                    inline_keyboard: [
                      [{ text: "⬅️ Retour", callback_data: "back" }],
                      [{ text: "🕵🏻‍♂️ Gérer le bot", callback_data: "paneladmin" }],
                    ],
                  },
                }
              );
            }
          )
        }
        if (query.data === "button3") {
          const username = query.from.username;
          const userId = query.from.id;

          bot.sendMessage(
            chatId,
            "ℹ️ Entrez le montant que vous souhaitez ajouter à votre compte :",
          ).then((message) => { 

            bot.once("message", (replyMessage) => {
              const amount = parseFloat(replyMessage.text.replace(",", "."));

              if (isNaN(amount) || amount < 5) {
                bot.sendMessage(
                  chatId,
                  "❌ Montant invalide. Le montant minimum est de 5€."
                  
                );
                return;
              }
              const data = JSON.stringify({
                "name": `${username}`,
                "metadata": {
                  "customer_id": userId
                },
                "local_price": {
                  "amount": amount.toFixed(2),
                  "currency": "EUR"
                },
                "pricing_type": "fixed_price"
              });
              const config = {
                method: 'post',
                url: 'https://api.commerce.coinbase.com/charges',
                headers: { 
                  'Content-Type': 'application/json', 
                  'Accept': 'application/json',
                  'X-CC-Api-Key': 'b7db06a4-db83-419f-9677-94de4b06bfa3',
                },
                data: data
              };
              axios(config)
                .then((response) => {
                  paymentUrl = response.data.data.hosted_url;
                  console.log(`Succès de la charge : ${paymentUrl}`);
                  bot.editMessageText(
                    `Cliquez sur le lien ci-dessous pour payer ${amount.toFixed(2)}€ : \n\n➡️ ${paymentUrl}`,
                    {
                      chat_id: chatId,
                      message_id: message.message_id, 
                      reply_markup: {
                        inline_keyboard: [
                          [{text: "🔎 Vérifier la transaction", callback_data:"verify_charges"}],
                          [{ text: "⬅️ Retour", callback_data: "back" }]
                        ],
                      },
                    }
                  );
                })
                .catch((error) => {
                  console.log("Error creating Coinbase charge:", error);
                });
            });
          });
        } else if (query.data === "back") {
          const username = query.from.username;
          const userId = query.from.id;
          bot.editMessageText(
            `Salut, ${username} que souhaitez-vous faire aujourd'hui?\n\n👤 Auto-Shop de @sendgram | Canal proof: t.me/sendgram \n\n 💳 Votre solde est actuellement de €.`,
            {
              chat_id: chatId,
              message_id: query.message.message_id,
              reply_markup: {
                inline_keyboard: [
                  [{ text: "🛒 Boutique", callback_data: "button1" }],
                  [
                    { text: "👤 Mon compte", callback_data: "button2" },
                    { text: "💰 Recharger le compte", callback_data: "button3" },
                  ],
                ],
              },
            }
          );
        }
        
        if (query.data === "verify_charges") {
          const username = query.from.username;
          const userId = query.from.id;
          bot.sendMessage(chatId, "⏳ Vérification en cours...");
          const axios = require('axios')
          console.log(paymentUrl)
      
        axios.get(paymentUrl)
          .then(response => {
            const timeline = response.data.data.timeline
            let expiredStatus = null;
            let completedStatus = null;
            let newStatus = null;
            for (let i = 0; i < timeline.length; i++) {
              if (timeline[i].status === 'EXPIRED') {
                expiredStatus = timeline[i];
              }
              if (timeline[i].status === 'COMPLETED') {
                completedStatus = timeline[i];
              }
              if (timeline[i].status === 'NEW') {
                newStatus = timeline[i];
              }
            }
            if (expiredStatus) {
              status = expiredStatus.status;
            }
            else if (completedStatus) {
              status = completedStatus.status;
            }
            else if (newStatus) {
              status = newStatus.status;
            }
            console.log("Status", status)
          })
          .catch(error => {
            console.log("erreur");
          });
        } else if (query.data === "verify_charges") {  
    const username = query.from.username;
    const userId = query.from.id;
    bot.sendMessage(chatId, "⏳ Vérification en cours...");
    console.log("2ème requête paymentUrl :", paymentUrl);
  
    axios.get(paymentUrl)
      .then(response => {
        const timeline = response.data.data.timeline
        let expiredStatus = null;
        let completedStatus = null;
        let newStatus = null;
        for (let i = 0; i < timeline.length; i++) {
          if (timeline[i].status === 'EXPIRED') {
            expiredStatus = timeline[i];
          }
          if (timeline[i].status === 'COMPLETED') {
            completedStatus = timeline[i];
          }
          if (timeline[i].status === 'NEW') {
            newStatus = timeline[i];
          }
        }
        if (expiredStatus) {
          status = expiredStatus.status;
        }
        else if (completedStatus) {
          status = completedStatus.status;
        }
        else if (newStatus) {
          status = newStatus.status;
        }
        console.log("Status", status)
      })
     }
    

     bot.on("callback_query", (query) => {
      const chatId = query.message.chat.id;
      if (query.data === "paneladmin") {
        adminController.panelAdmin(query, bot, chatId); // utiliser panelAdmin au lieu de adminPanel
      } else if (query.data === "add_admin") {
        adminController.addAdmin(query, bot, chatId, pool);
      } else if (query.data === "logs") {
        // create shop logs
      } else if (query.data === "DMall") {
        // DMall callback
      } else if (query.data === "button5") {
        // button5 callback
      } else if (query.data === "createshop") {
        // createshop callback
      } else if (query.data === "back") {
        // back callback
      } else {
        // unknown callback
      }
    });
    
    if (query.data === "createshop") {
      const chatId = query.message.chat.id;
      const messageId = query.message.message_id;
      const username = query.from.username;
      const userId = query.from.id;
    
      bot.editMessageText(
        `Quel type de boutique souhaitez-vous ajouter au bot ?`,
        {
          chat_id: chatId,
          message_id: messageId,
          reply_markup: {
            inline_keyboard: [
              [
                { text: "📍 Plesk", callback_data: "logs" },
                { text: "📍 Scama", callback_data: "scama" },
              ],
              [
                { text: "📍 CC", callback_data: "CC" },
                { text: "📍 eSIM", callback_data: "esim" },
              ],
              [
                { text: "📍 Logs", callback_data: "logs" },
                { text: "📍 Numlist", callback_data: "Numlist" },
                { text: "📍 Mailist", callback_data: "mailist" },
              ],
              [{ text: "⬅️ Retour", callback_data: "back" }],
            ],
          },
        }
      );    
    bot.on("callback_query", (query) => {
      if (query.data === "logs") {
        bot.sendMessage(chatId, "Veuillez entrer votre adresse e-mail :");
        let email = "";
        let password = "";
        let isRequestingPassword = false; // variable de statut
    
        bot.once("message", (message) => {
          if (!isRequestingPassword) {
            // L'utilisateur entre son adresse e-mail
            email = message.text;
            bot.sendMessage(chatId, "Veuillez entrer votre mot de passe :");
            isRequestingPassword = true;
          } else {
            // L'utilisateur entre son mot de passe
            password = message.text;
            const fs = require("fs");
            const data = {
              [email]: password,
            };
            const folderPath = "stock"; // Nom du dossier
            const filePath = `${folderPath}/stock_logs.json`; // Emplacement complet du fichier
            fs.writeFile(filePath, JSON.stringify(data), (err) => {
              if (err) throw err;
              console.log("Informations de compte enregistrées dans stock_logs.json");
    
              // Ajout du bouton pour ajouter plus de stock
              bot.sendMessage(chatId, "Informations de compte enregistrées avec succès !", {
                reply_markup: {
                  inline_keyboard: [
                    [
                      {
                        text: "Ajouter plus de stock",
                        callback_data: "add_stock",
                      },
                    ],
                  ],
                },
              });
            });
    
            isRequestingPassword = false;
          }
        });
      } else if (query.data === "add_stock") {
        bot.sendMessage(chatId, "Veuillez entrer votre adresse e-mail :");
      }
    });    
      }});
  })