You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no protection (filter) in your project by account telegram ID, so anyone who can access the BOT will be able to use its properties. It is necessary to limit consumption, because otherwise you can incur large financial losses.
Anyone who is included in the list and has his ID is able to work with the bot in the file ('./config/user id.json').
Hello, sorry, but I didnt understand. I created this bot for practice in Node JS. It doesnt work without running on my localhost because I dont want to deploy it on any server like render.com or others. If you want to use it You can download it, register own bot, get keys from Telegram and OpenAI and go ahead
There is no protection (filter) in your project by account telegram ID, so anyone who can access the BOT will be able to use its properties. It is necessary to limit consumption, because otherwise you can incur large financial losses.
Anyone who is included in the list and has his ID is able to work with the bot in the file ('./config/user id.json').
const userIds = JSON.parse(fs.readFileSync('./config/userid.json'));
bot.on(message('voice'), async (ctx) => {
ctx.session ??= INITIAL_SESSION
try {
const userId = ctx.message.from.id
if (userIds.includes(userId)) {
await ctx.reply(code('"Ok, Please wait..."'))
const link = await ctx.telegram.getFileLink(ctx.message.voice.file_id)
const userId = String(ctx.message.from.id)
const oggPath = await ogg.create(link.href, userId)
const mp3Path = await ogg.toMp3(oggPath, userId)
} catch (e) {
console.log(
Error while voice message
, e.message)}
})
bot.on(message('text'), async (ctx) => {
ctx.session ??= INITIAL_SESSION
try {
const userId = ctx.message.from.id
if (userIds.includes(userId)) {
await ctx.reply(code('"Ok, Please wait..."'))
await processTextToChat(ctx, ctx.message.text)
} else {
await ctx.reply(code('https://link.com/bay_limit_day'))
}
} catch (e) {
console.log(
Error while voice message
, e.message)}
})
The text was updated successfully, but these errors were encountered: