scnario commited on
Commit
1f94ec1
·
verified ·
1 Parent(s): 007119d

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +1 -13
server.js CHANGED
@@ -6,20 +6,7 @@ const express = require('express');
6
 
7
  const bot = new TelegramBot('7727911031:AAFcPGWeyTynR1FR7Hhpr4HoGDeA4hk9Ebs', { polling: true });
8
  const app = express();
9
- const TMP_DIR = os.tmpdir();
10
 
11
- const getFilePath = (chatId) => path.join(TMP_DIR, `${chatId}.txt`);
12
- const readFilters = (chatId) => fs.existsSync(getFilePath(chatId)) ? JSON.parse(fs.readFileSync(getFilePath(chatId))) : {};
13
- const saveFilters = (chatId, filters) => fs.writeFileSync(getFilePath(chatId), JSON.stringify(filters));
14
-
15
- const isOwner = async (chatId, userId) => {
16
- try {
17
- const admins = await bot.getChatAdministrators(chatId);
18
- return admins.find(a => a.status === 'creator')?.user.id === userId;
19
- } catch {
20
- return false;
21
- }
22
- };
23
 
24
  function formatStorageSize(bytes) {
25
  const KB = 1024
@@ -63,6 +50,7 @@ bot.on('message', async(msg) => {
63
  const regex = /(?:surl=|\/)([a-zA-Z0-9-_]+)$/
64
  const match = url.match(regex)
65
  if(!match) return
 
66
  let inpo = await fetchInfo(match[1])
67
  if(!inpo.ok) return
68
  let d = {
 
6
 
7
  const bot = new TelegramBot('7727911031:AAFcPGWeyTynR1FR7Hhpr4HoGDeA4hk9Ebs', { polling: true });
8
  const app = express();
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  function formatStorageSize(bytes) {
12
  const KB = 1024
 
50
  const regex = /(?:surl=|\/)([a-zA-Z0-9-_]+)$/
51
  const match = url.match(regex)
52
  if(!match) return
53
+ bot.sendMessage(cid, 'please wait..')
54
  let inpo = await fetchInfo(match[1])
55
  if(!inpo.ok) return
56
  let d = {