04.11.2022, 19:02
Natürlich
Hier ein ein paar ausschnitte , leider nicht von allen Dateien ^^ wäre sonst zu viel:
package-lock.json:
"name": "product_googlesheets",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "14.14.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.21.tgz",
"integrity": "sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A==",
"optional": true
},
"@types/yauzl": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz",
"integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==",
"optional": true,
"requires": {
"@types/node": "*"
}
},
"abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
index.js:
const util = require('util')
require('dotenv').config()
process.on('uncaughtException', function (err) {
console.log('Caught exception: ', err)
})
process.on('unhandledRejection', (error, promise) => {
console.log('Forgot to handle a promise rejection here: ', promise)
console.log(error)
})
var log_file = fs.createWriteStream(__dirname + '/main.log', {
flags: 'w'
})
var log_stdout = process.stdout
let getDateTime = () => {
let date = new Date()
let hour = date.getHours()
hour = (hour < 10 ? "0" : "") + hour
let min = date.getMinutes()
min = (min < 10 ? "0" : "") + min
let sec = date.getSeconds()
sec = (sec < 10 ? "0" : "") + sec
let year = date.getFullYear()
let month = date.getMonth() + 1
month = (month < 10 ? "0" : "") + month
let day = date.getDate()
day = (day < 10 ? "0" : "") + day
return year + "." + month + "." + day + ". " + hour + ":" + min + ":" + sec
}
console.log = function (d) {
let currentTime = '[' + getDateTime() + '] '
bot.js:
const Telegraf = require('telegraf')
const Telegram = require('telegraf/telegram')
const session = require('telegraf/session')
const block = require('./manager/block')
const bot = new Telegraf(process.env.token)
const telegram = new Telegram(process.env.token)
bot.use(session())
bot.launch()
console.log('Bot started.')
bot.use(async (ctx, next) => {
//if(!ctx?.from?.username) return
if (ctx.from && ctx.from.id && block.isBlocked(ctx.from.id)) return
next()
})
module.exports = {
bot,
telegram
wie gesagt , sind nur ein paar Auszüge , bin für jede Hilfe SEHR SEHR DANKBAR
Hier ein ein paar ausschnitte , leider nicht von allen Dateien ^^ wäre sonst zu viel:
package-lock.json:
"name": "product_googlesheets",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "14.14.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.21.tgz",
"integrity": "sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A==",
"optional": true
},
"@types/yauzl": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz",
"integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==",
"optional": true,
"requires": {
"@types/node": "*"
}
},
"abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
index.js:
const util = require('util')
require('dotenv').config()
process.on('uncaughtException', function (err) {
console.log('Caught exception: ', err)
})
process.on('unhandledRejection', (error, promise) => {
console.log('Forgot to handle a promise rejection here: ', promise)
console.log(error)
})
var log_file = fs.createWriteStream(__dirname + '/main.log', {
flags: 'w'
})
var log_stdout = process.stdout
let getDateTime = () => {
let date = new Date()
let hour = date.getHours()
hour = (hour < 10 ? "0" : "") + hour
let min = date.getMinutes()
min = (min < 10 ? "0" : "") + min
let sec = date.getSeconds()
sec = (sec < 10 ? "0" : "") + sec
let year = date.getFullYear()
let month = date.getMonth() + 1
month = (month < 10 ? "0" : "") + month
let day = date.getDate()
day = (day < 10 ? "0" : "") + day
return year + "." + month + "." + day + ". " + hour + ":" + min + ":" + sec
}
console.log = function (d) {
let currentTime = '[' + getDateTime() + '] '
bot.js:
const Telegraf = require('telegraf')
const Telegram = require('telegraf/telegram')
const session = require('telegraf/session')
const block = require('./manager/block')
const bot = new Telegraf(process.env.token)
const telegram = new Telegram(process.env.token)
bot.use(session())
bot.launch()
console.log('Bot started.')
bot.use(async (ctx, next) => {
//if(!ctx?.from?.username) return
if (ctx.from && ctx.from.id && block.isBlocked(ctx.from.id)) return
next()
})
module.exports = {
bot,
telegram
wie gesagt , sind nur ein paar Auszüge , bin für jede Hilfe SEHR SEHR DANKBAR