• Ищем качественного (не новичок) разработчиков Xenforo для этого форума! В идеале, чтобы ты был фулл стек программистом. Если у тебя есть что показать, то свяжись с нами по контактным данным: https://t.me/DREDD

Прочее Средняя цена предметов AH бот | mineflayer

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
5 Ноя 2022
Сообщения
70
Реакции
0
Выберите загрузчик игры
  1. Прочие моды
Бот для анализа цен на аукционе сервера mc.funtime.su. Отслеживает цены предметов, учитывая их характеристики, зачарования и количество.

# Возможности
  • Анализ цен предметов с учетом их чар (пытался чет сделать но забил, под дефолт предметы работает)
  • Отслеживание не нормальных цен
  • Расчет медианной цены и рекомендуемой максимальной цены
  • Сохранение истории цен в JSON файл

Ну как игрушка думаю пойдет :0

SS ->

1741179001959.png
1741179020950.png


CODE
JavaScript:
Expand Collapse Copy
const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
  host: 'mc.funtime.su',
  username: 'Qipuloyahej_',
  version: '1.16.5',
  hideErrors: true,
})

const priceHistory = new Map()

function calculateMedianPrice(prices) {
  if (prices.length === 0) return 0

  const sortedPrices = [...prices].sort((a, b) => a - b)
  const cutoff = Math.floor(sortedPrices.length * 0.1)
  const filteredPrices = sortedPrices.slice(cutoff, sortedPrices.length - cutoff)

  if (filteredPrices.length === 0) return sortedPrices[0]

  const mid = Math.floor(filteredPrices.length / 2)
  return filteredPrices.length % 2 === 0
    ? (filteredPrices[mid - 1] + filteredPrices[mid]) / 2
    : filteredPrices[mid]
}

function isPriceAnomaly(price, itemName) {
  const history = priceHistory.get(itemName)
  if (!history || history.length < 5) return false

  const median = calculateMedianPrice(history)
  return price > median * 3 || price < median / 3
}

function getItemKey(item) {
  let key = item.name
  let stats = []
  let count = item.count || 1

  if (item.enchants) {
    Object.entries(item.enchants).forEach(([enchName, level]) => {
      stats.push(`${enchName}=${level}`)
    })
  }

  try {
    if (item.customLore) {
      item.customLore.forEach(loreLine => {
        try {
          const loreJson = JSON.parse(loreLine)
          if (loreJson.extra) {
            loreJson.extra.forEach(extraItem => {
              if (extraItem.text) {
                const text = extraItem.text.trim()
               
                const countMatch = text.match(/[xх](\d+)/i)
                if (countMatch) {
                  count = parseInt(countMatch[1])
                }
               
                if (
                  text.includes('Сила') ||
                  text.includes('Здоровье') ||
                  text.includes('Защита') ||
                  text.includes('Скорость') ||
                  text.includes('Урон') ||
                  text.includes('Острота') ||
                  text.includes('Защита') ||
                  text.includes('Эффективность') ||
                  text.includes('Прочность')
                ) {
                  const cleanText = text.replace(/§[0-9a-fk-or]/g, '').trim()
                  if (cleanText) {
                    stats.push(cleanText)
                  }
                }
               
                const romanNumerals = text.match(/\s[IVX]+\b/)
                if (romanNumerals) {
                  stats[stats.length - 1] += romanNumerals[0].trim()
                }
              }
            })
          }
        } catch (e) {}
      })
    }
  } catch (e) {}

  key += `#count=${count}`

  if (stats.length > 0) {
    stats = [...new Set(stats)].sort()
    key += '#stats=' + stats.join('|')
  }

  return { key, count, stats }
}

function analyzePriceAndUpdate(item, price) {
  const { key: itemKey, count, stats } = getItemKey(item)

  if (!priceHistory.has(itemKey)) {
    priceHistory.set(itemKey, [])
  }

  const pricePerItem = Math.round(price / count)
  const history = priceHistory.get(itemKey)
  history.push(pricePerItem)

  if (history.length > 100) {
    history.shift()
  }

  const median = calculateMedianPrice(history)
  const isAnomaly = isPriceAnomaly(pricePerItem, itemKey)

  saveStatsToJson()

  return {
    currentPrice: price,
    pricePerItem,
    count,
    stats,
    medianPrice: median,
    medianTotalPrice: median * count,
    isAnomaly,
    pricesAnalyzed: history.length,
    recommendedMaxPrice: median * 1.2 * count,
    itemKey
  }
}

function saveStatsToJson() {
  const stats = {}

  for (const [itemKey, prices] of priceHistory.entries()) {
    const [itemName, ...params] = itemKey.split('#')
    const count = parseInt(params.find(p => p.startsWith('count='))?.split('=')[1] || 1)
   
    stats[itemKey] = {
      itemName,
      count,
      medianPricePerItem: calculateMedianPrice(prices),
      medianTotalPrice: calculateMedianPrice(prices) * count,
      minPricePerItem: Math.min(...prices),
      maxPricePerItem: Math.max(...prices),
      pricesAnalyzed: prices.length,
      lastUpdate: new Date().toISOString(),
      priceHistory: prices.slice(-50)
    }
  }

  require('fs').writeFileSync('price_stats.json', JSON.stringify(stats, null, 2))
}

bot.once('spawn', () => {
  console.log('Бот заспавнился!')
  bot.chat('/an103')
  setTimeout(() => {
    bot.chat('/ah')
  }, 11000)
})

bot.on('windowOpen', async (window) => {
  if (window.title.includes('Аукцион')) {
    console.log('Аукцион открыт!')
   
    for (const item of window.slots) {
      if (!item) continue
     
      if (item.customLore) {
        try {
          const itemLore = item.customLore
          let price = ''
          let seller = ''
         
          itemLore.forEach(loreLine => {
            try {
              const loreJson = JSON.parse(loreLine)
             
              if (loreJson.extra) {
                loreJson.extra.forEach(extraItem => {
                  if (extraItem.text && extraItem.text.includes('$')) {
                    const cleanPrice = extraItem.text.replace('$', '').replace(/,/g, '')
                    if (!isNaN(cleanPrice)) {
                      price = parseInt(cleanPrice)
                    }
                  }
                })
              }
             
              if (loreJson.extra) {
                loreJson.extra.forEach(extraItem => {
                  if (extraItem.text && extraItem.color === 'gold') {
                    seller = extraItem.text.trim()
                  }
                })
              }
            } catch (e) {}
          })
         
          if (price) {
            const analysis = analyzePriceAndUpdate(item, price)
           
            console.log(`Предмет: ${item.name} (x${analysis.count})`)
            if (analysis.stats && analysis.stats.length > 0) {
              console.log('Характеристики:')
              analysis.stats.forEach(stat => console.log(`  - ${stat}`))
            } else {
              console.log('Характеристики: нет')
            }
            console.log(`Текущая цена: ${price} (${analysis.pricePerItem} за штуку)`)
            console.log(`Медианная цена: ${analysis.medianPrice} за штуку`)
            console.log(`Медианная цена за все: ${analysis.medianTotalPrice}`)
            console.log(`Рекомендуемая макс. цена: ${analysis.recommendedMaxPrice}`)
            if (analysis.isAnomaly) {
              console.log('⚠ ВНИМАНИЕ: Подозрительная цена!')
            }
            console.log(`Проанализировано цен: ${analysis.pricesAnalyzed}`)
            if (seller) console.log('Истекает через:', seller)
            console.log('-------------------')
          }
        } catch (error) {}
      }
    }
    await new Promise(resolve => setTimeout(resolve, 1000))
    bot.simpleClick.leftMouse(49).catch(() => {})
  }
})

bot.on('message', (message) => {
  const msg = message.toString()

  try {
    if (msg.includes('customLore')) {
      const itemLore = msg
      const jsonString = `[${itemLore}]`
     
      const loreArray = JSON.parse(jsonString)
      let price = ''
     
      loreArray.forEach(item => {
        if (item.extra) {
          item.extra.forEach((extraItem) => {
            if (extraItem.text) {
              if (extraItem.text.includes('Ценa') || extraItem.text.includes('$')) {
                price += extraItem.text.trim() + ' '
              }
            }
          })
        }
      })
     
      if (price) {
        console.log('Найдена цена:', price)
      }
    }
  } catch (error) {}
})

bot.on('error', (err) => {
  console.error('Произошла ошибка:', err)
})

bot.on('kicked', (reason) => {
  console.log('Бот был кикнут:', reason)
})

bot.on('end', () => {
  console.log('Бот отключился от сервера')
})
 
Бот для анализа цен на аукционе сервера mc.funtime.su. Отслеживает цены предметов, учитывая их характеристики, зачарования и количество.

# Возможности
  • Анализ цен предметов с учетом их чар (пытался чет сделать но забил, под дефолт предметы работает)
  • Отслеживание не нормальных цен
  • Расчет медианной цены и рекомендуемой максимальной цены
  • Сохранение истории цен в JSON файл

Ну как игрушка думаю пойдет :0

SS ->

Посмотреть вложение 300394Посмотреть вложение 300395

CODE
JavaScript:
Expand Collapse Copy
const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
  host: 'mc.funtime.su',
  username: 'Qipuloyahej_',
  version: '1.16.5',
  hideErrors: true,
})

const priceHistory = new Map()

function calculateMedianPrice(prices) {
  if (prices.length === 0) return 0

  const sortedPrices = [...prices].sort((a, b) => a - b)
  const cutoff = Math.floor(sortedPrices.length * 0.1)
  const filteredPrices = sortedPrices.slice(cutoff, sortedPrices.length - cutoff)

  if (filteredPrices.length === 0) return sortedPrices[0]

  const mid = Math.floor(filteredPrices.length / 2)
  return filteredPrices.length % 2 === 0
    ? (filteredPrices[mid - 1] + filteredPrices[mid]) / 2
    : filteredPrices[mid]
}

function isPriceAnomaly(price, itemName) {
  const history = priceHistory.get(itemName)
  if (!history || history.length < 5) return false

  const median = calculateMedianPrice(history)
  return price > median * 3 || price < median / 3
}

function getItemKey(item) {
  let key = item.name
  let stats = []
  let count = item.count || 1

  if (item.enchants) {
    Object.entries(item.enchants).forEach(([enchName, level]) => {
      stats.push(`${enchName}=${level}`)
    })
  }

  try {
    if (item.customLore) {
      item.customLore.forEach(loreLine => {
        try {
          const loreJson = JSON.parse(loreLine)
          if (loreJson.extra) {
            loreJson.extra.forEach(extraItem => {
              if (extraItem.text) {
                const text = extraItem.text.trim()
              
                const countMatch = text.match(/[xх](\d+)/i)
                if (countMatch) {
                  count = parseInt(countMatch[1])
                }
              
                if (
                  text.includes('Сила') ||
                  text.includes('Здоровье') ||
                  text.includes('Защита') ||
                  text.includes('Скорость') ||
                  text.includes('Урон') ||
                  text.includes('Острота') ||
                  text.includes('Защита') ||
                  text.includes('Эффективность') ||
                  text.includes('Прочность')
                ) {
                  const cleanText = text.replace(/§[0-9a-fk-or]/g, '').trim()
                  if (cleanText) {
                    stats.push(cleanText)
                  }
                }
              
                const romanNumerals = text.match(/\s[IVX]+\b/)
                if (romanNumerals) {
                  stats[stats.length - 1] += romanNumerals[0].trim()
                }
              }
            })
          }
        } catch (e) {}
      })
    }
  } catch (e) {}

  key += `#count=${count}`

  if (stats.length > 0) {
    stats = [...new Set(stats)].sort()
    key += '#stats=' + stats.join('|')
  }

  return { key, count, stats }
}

function analyzePriceAndUpdate(item, price) {
  const { key: itemKey, count, stats } = getItemKey(item)

  if (!priceHistory.has(itemKey)) {
    priceHistory.set(itemKey, [])
  }

  const pricePerItem = Math.round(price / count)
  const history = priceHistory.get(itemKey)
  history.push(pricePerItem)

  if (history.length > 100) {
    history.shift()
  }

  const median = calculateMedianPrice(history)
  const isAnomaly = isPriceAnomaly(pricePerItem, itemKey)

  saveStatsToJson()

  return {
    currentPrice: price,
    pricePerItem,
    count,
    stats,
    medianPrice: median,
    medianTotalPrice: median * count,
    isAnomaly,
    pricesAnalyzed: history.length,
    recommendedMaxPrice: median * 1.2 * count,
    itemKey
  }
}

function saveStatsToJson() {
  const stats = {}

  for (const [itemKey, prices] of priceHistory.entries()) {
    const [itemName, ...params] = itemKey.split('#')
    const count = parseInt(params.find(p => p.startsWith('count='))?.split('=')[1] || 1)
  
    stats[itemKey] = {
      itemName,
      count,
      medianPricePerItem: calculateMedianPrice(prices),
      medianTotalPrice: calculateMedianPrice(prices) * count,
      minPricePerItem: Math.min(...prices),
      maxPricePerItem: Math.max(...prices),
      pricesAnalyzed: prices.length,
      lastUpdate: new Date().toISOString(),
      priceHistory: prices.slice(-50)
    }
  }

  require('fs').writeFileSync('price_stats.json', JSON.stringify(stats, null, 2))
}

bot.once('spawn', () => {
  console.log('Бот заспавнился!')
  bot.chat('/an103')
  setTimeout(() => {
    bot.chat('/ah')
  }, 11000)
})

bot.on('windowOpen', async (window) => {
  if (window.title.includes('Аукцион')) {
    console.log('Аукцион открыт!')
  
    for (const item of window.slots) {
      if (!item) continue
    
      if (item.customLore) {
        try {
          const itemLore = item.customLore
          let price = ''
          let seller = ''
        
          itemLore.forEach(loreLine => {
            try {
              const loreJson = JSON.parse(loreLine)
            
              if (loreJson.extra) {
                loreJson.extra.forEach(extraItem => {
                  if (extraItem.text && extraItem.text.includes('$')) {
                    const cleanPrice = extraItem.text.replace('$', '').replace(/,/g, '')
                    if (!isNaN(cleanPrice)) {
                      price = parseInt(cleanPrice)
                    }
                  }
                })
              }
            
              if (loreJson.extra) {
                loreJson.extra.forEach(extraItem => {
                  if (extraItem.text && extraItem.color === 'gold') {
                    seller = extraItem.text.trim()
                  }
                })
              }
            } catch (e) {}
          })
        
          if (price) {
            const analysis = analyzePriceAndUpdate(item, price)
          
            console.log(`Предмет: ${item.name} (x${analysis.count})`)
            if (analysis.stats && analysis.stats.length > 0) {
              console.log('Характеристики:')
              analysis.stats.forEach(stat => console.log(`  - ${stat}`))
            } else {
              console.log('Характеристики: нет')
            }
            console.log(`Текущая цена: ${price} (${analysis.pricePerItem} за штуку)`)
            console.log(`Медианная цена: ${analysis.medianPrice} за штуку`)
            console.log(`Медианная цена за все: ${analysis.medianTotalPrice}`)
            console.log(`Рекомендуемая макс. цена: ${analysis.recommendedMaxPrice}`)
            if (analysis.isAnomaly) {
              console.log('⚠ ВНИМАНИЕ: Подозрительная цена!')
            }
            console.log(`Проанализировано цен: ${analysis.pricesAnalyzed}`)
            if (seller) console.log('Истекает через:', seller)
            console.log('-------------------')
          }
        } catch (error) {}
      }
    }
    await new Promise(resolve => setTimeout(resolve, 1000))
    bot.simpleClick.leftMouse(49).catch(() => {})
  }
})

bot.on('message', (message) => {
  const msg = message.toString()

  try {
    if (msg.includes('customLore')) {
      const itemLore = msg
      const jsonString = `[${itemLore}]`
    
      const loreArray = JSON.parse(jsonString)
      let price = ''
    
      loreArray.forEach(item => {
        if (item.extra) {
          item.extra.forEach((extraItem) => {
            if (extraItem.text) {
              if (extraItem.text.includes('Ценa') || extraItem.text.includes('$')) {
                price += extraItem.text.trim() + ' '
              }
            }
          })
        }
      })
    
      if (price) {
        console.log('Найдена цена:', price)
      }
    }
  } catch (error) {}
})

bot.on('error', (err) => {
  console.error('Произошла ошибка:', err)
})

bot.on('kicked', (reason) => {
  console.log('Бот был кикнут:', reason)
})

bot.on('end', () => {
  console.log('Бот отключился от сервера')
})
завоз
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
джпт солюшионс, параша бесполезная
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
какой адекватный человек, в здравом уме, будет называть методы по типу "calculateMedianPrice", "analyzePriceAndUpdate" или поля с названиями "recommendedMaxPrice"
тоесть не стандартные название методов приравниваются к чату лгбт? блять бро да ты умён
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
нет ты просто аутист, ты не понимаешь на что именно я тригеррюсь, опять же НИ ОДИН адекватный человек не будет писать ANALYZEPRICEANDUPDATE,
чат джпт оставляет в методах воду, если ты этого не знаешь, так вальни еблет

Посмотреть вложение 300529
да и чувачок, ты его другие "полезные" функциональности посмотри, там видно чистый джпт
я буду писать название методов как penisinitzalupi
а так не к этому но код реально похож на гпт
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
я буду писать название методов как penisinitzalupi
еще один нашелся, то что ты назвал penisinitzalupi хотя бы понятно что не ии, а это ебатень ANALYZEPRICEANDUPDATE, ну блять тут с первого взгляда понятно что ии, вдобавок я прикрепил скрин, что он юзает ии везде в своих никому не нужных постах
 
Дааа, давай те дружно будет писать что писала нейронка и что обычный человек не умеет так делать, ОК. Забудем что код я запостил что бы кто то научился чему то а не что бы седели и говорили так и так, имена констант специально были написаны для людей с плохим умом. Что бы избежать вопросов - ЫЫ А ЧТО ЗА ПЕРЕМЕННАЯ ОТВЕЧАЕТ ЗА ЭТО.
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Бот для анализа цен на аукционе сервера mc.funtime.su. Отслеживает цены предметов, учитывая их характеристики, зачарования и количество.

# Возможности
  • Анализ цен предметов с учетом их чар (пытался чет сделать но забил, под дефолт предметы работает)
  • Отслеживание не нормальных цен
  • Расчет медианной цены и рекомендуемой максимальной цены
  • Сохранение истории цен в JSON файл

Ну как игрушка думаю пойдет :0

SS ->

Посмотреть вложение 300394Посмотреть вложение 300395

CODE
JavaScript:
Expand Collapse Copy
const mineflayer = require('mineflayer')

const bot = mineflayer.createBot({
  host: 'mc.funtime.su',
  username: 'Qipuloyahej_',
  version: '1.16.5',
  hideErrors: true,
})

const priceHistory = new Map()

function calculateMedianPrice(prices) {
  if (prices.length === 0) return 0

  const sortedPrices = [...prices].sort((a, b) => a - b)
  const cutoff = Math.floor(sortedPrices.length * 0.1)
  const filteredPrices = sortedPrices.slice(cutoff, sortedPrices.length - cutoff)

  if (filteredPrices.length === 0) return sortedPrices[0]

  const mid = Math.floor(filteredPrices.length / 2)
  return filteredPrices.length % 2 === 0
    ? (filteredPrices[mid - 1] + filteredPrices[mid]) / 2
    : filteredPrices[mid]
}

function isPriceAnomaly(price, itemName) {
  const history = priceHistory.get(itemName)
  if (!history || history.length < 5) return false

  const median = calculateMedianPrice(history)
  return price > median * 3 || price < median / 3
}

function getItemKey(item) {
  let key = item.name
  let stats = []
  let count = item.count || 1

  if (item.enchants) {
    Object.entries(item.enchants).forEach(([enchName, level]) => {
      stats.push(`${enchName}=${level}`)
    })
  }

  try {
    if (item.customLore) {
      item.customLore.forEach(loreLine => {
        try {
          const loreJson = JSON.parse(loreLine)
          if (loreJson.extra) {
            loreJson.extra.forEach(extraItem => {
              if (extraItem.text) {
                const text = extraItem.text.trim()
              
                const countMatch = text.match(/[xх](\d+)/i)
                if (countMatch) {
                  count = parseInt(countMatch[1])
                }
              
                if (
                  text.includes('Сила') ||
                  text.includes('Здоровье') ||
                  text.includes('Защита') ||
                  text.includes('Скорость') ||
                  text.includes('Урон') ||
                  text.includes('Острота') ||
                  text.includes('Защита') ||
                  text.includes('Эффективность') ||
                  text.includes('Прочность')
                ) {
                  const cleanText = text.replace(/§[0-9a-fk-or]/g, '').trim()
                  if (cleanText) {
                    stats.push(cleanText)
                  }
                }
              
                const romanNumerals = text.match(/\s[IVX]+\b/)
                if (romanNumerals) {
                  stats[stats.length - 1] += romanNumerals[0].trim()
                }
              }
            })
          }
        } catch (e) {}
      })
    }
  } catch (e) {}

  key += `#count=${count}`

  if (stats.length > 0) {
    stats = [...new Set(stats)].sort()
    key += '#stats=' + stats.join('|')
  }

  return { key, count, stats }
}

function analyzePriceAndUpdate(item, price) {
  const { key: itemKey, count, stats } = getItemKey(item)

  if (!priceHistory.has(itemKey)) {
    priceHistory.set(itemKey, [])
  }

  const pricePerItem = Math.round(price / count)
  const history = priceHistory.get(itemKey)
  history.push(pricePerItem)

  if (history.length > 100) {
    history.shift()
  }

  const median = calculateMedianPrice(history)
  const isAnomaly = isPriceAnomaly(pricePerItem, itemKey)

  saveStatsToJson()

  return {
    currentPrice: price,
    pricePerItem,
    count,
    stats,
    medianPrice: median,
    medianTotalPrice: median * count,
    isAnomaly,
    pricesAnalyzed: history.length,
    recommendedMaxPrice: median * 1.2 * count,
    itemKey
  }
}

function saveStatsToJson() {
  const stats = {}

  for (const [itemKey, prices] of priceHistory.entries()) {
    const [itemName, ...params] = itemKey.split('#')
    const count = parseInt(params.find(p => p.startsWith('count='))?.split('=')[1] || 1)
  
    stats[itemKey] = {
      itemName,
      count,
      medianPricePerItem: calculateMedianPrice(prices),
      medianTotalPrice: calculateMedianPrice(prices) * count,
      minPricePerItem: Math.min(...prices),
      maxPricePerItem: Math.max(...prices),
      pricesAnalyzed: prices.length,
      lastUpdate: new Date().toISOString(),
      priceHistory: prices.slice(-50)
    }
  }

  require('fs').writeFileSync('price_stats.json', JSON.stringify(stats, null, 2))
}

bot.once('spawn', () => {
  console.log('Бот заспавнился!')
  bot.chat('/an103')
  setTimeout(() => {
    bot.chat('/ah')
  }, 11000)
})

bot.on('windowOpen', async (window) => {
  if (window.title.includes('Аукцион')) {
    console.log('Аукцион открыт!')
  
    for (const item of window.slots) {
      if (!item) continue
    
      if (item.customLore) {
        try {
          const itemLore = item.customLore
          let price = ''
          let seller = ''
        
          itemLore.forEach(loreLine => {
            try {
              const loreJson = JSON.parse(loreLine)
            
              if (loreJson.extra) {
                loreJson.extra.forEach(extraItem => {
                  if (extraItem.text && extraItem.text.includes('$')) {
                    const cleanPrice = extraItem.text.replace('$', '').replace(/,/g, '')
                    if (!isNaN(cleanPrice)) {
                      price = parseInt(cleanPrice)
                    }
                  }
                })
              }
            
              if (loreJson.extra) {
                loreJson.extra.forEach(extraItem => {
                  if (extraItem.text && extraItem.color === 'gold') {
                    seller = extraItem.text.trim()
                  }
                })
              }
            } catch (e) {}
          })
        
          if (price) {
            const analysis = analyzePriceAndUpdate(item, price)
          
            console.log(`Предмет: ${item.name} (x${analysis.count})`)
            if (analysis.stats && analysis.stats.length > 0) {
              console.log('Характеристики:')
              analysis.stats.forEach(stat => console.log(`  - ${stat}`))
            } else {
              console.log('Характеристики: нет')
            }
            console.log(`Текущая цена: ${price} (${analysis.pricePerItem} за штуку)`)
            console.log(`Медианная цена: ${analysis.medianPrice} за штуку`)
            console.log(`Медианная цена за все: ${analysis.medianTotalPrice}`)
            console.log(`Рекомендуемая макс. цена: ${analysis.recommendedMaxPrice}`)
            if (analysis.isAnomaly) {
              console.log('⚠ ВНИМАНИЕ: Подозрительная цена!')
            }
            console.log(`Проанализировано цен: ${analysis.pricesAnalyzed}`)
            if (seller) console.log('Истекает через:', seller)
            console.log('-------------------')
          }
        } catch (error) {}
      }
    }
    await new Promise(resolve => setTimeout(resolve, 1000))
    bot.simpleClick.leftMouse(49).catch(() => {})
  }
})

bot.on('message', (message) => {
  const msg = message.toString()

  try {
    if (msg.includes('customLore')) {
      const itemLore = msg
      const jsonString = `[${itemLore}]`
    
      const loreArray = JSON.parse(jsonString)
      let price = ''
    
      loreArray.forEach(item => {
        if (item.extra) {
          item.extra.forEach((extraItem) => {
            if (extraItem.text) {
              if (extraItem.text.includes('Ценa') || extraItem.text.includes('$')) {
                price += extraItem.text.trim() + ' '
              }
            }
          })
        }
      })
    
      if (price) {
        console.log('Найдена цена:', price)
      }
    }
  } catch (error) {}
})

bot.on('error', (err) => {
  console.error('Произошла ошибка:', err)
})

bot.on('kicked', (reason) => {
  console.log('Бот был кикнут:', reason)
})

bot.on('end', () => {
  console.log('Бот отключился от сервера')
})
cursor ai?
 
Назад
Сверху Снизу