Add configuration

This commit is contained in:
pixtaded 2024-08-28 15:20:46 +03:00
parent 3152ed000f
commit a2f935c53e
2 changed files with 9 additions and 3 deletions

4
config.example.json Normal file
View File

@ -0,0 +1,4 @@
{
"token": "Token",
"ALLOWED_IDS": ["1266775948548903026", "1151129960141037659", "1275008490959667234", "1234866477086019648", "1277611369578889277", "1242022836529266708", "1275098630059200586", "1277311957405405296", "1277936618749300760", "1275899048171409528"]
}

View File

@ -1,6 +1,7 @@
const { error } = require('console');
const { Client, Message, MessageAttachment } = require('discord.js-selfbot-v13');
const axios = require('axios');
const config = require('./config.json');
const client = new Client();
client.on('ready', async () => {
@ -11,8 +12,7 @@ let savedMessage;
let count = 0;
function isAllowedUser(id) {
let ALLOWED_IDS = ["1266775948548903026", "1151129960141037659", "1275008490959667234", "1234866477086019648", "1277611369578889277", "1242022836529266708", "1275098630059200586", "1277311957405405296", "1277936618749300760", "1275899048171409528"];
if (ALLOWED_IDS.find(string => string == id)) return true;
if (config.ALLOWED_IDS.find(string => string == id)) return true;
return false;
}
@ -23,12 +23,14 @@ async function getMessageContent(message) {
if (!attachment.url) {
console.error('URL вложения не найден.');
return "Я нихуя не понял.";
}
const response = await axios.get(attachment.url, { responseType: 'arraybuffer' });
if (!response.data) {
console.error('Ошибка: response.data is undefined.');
return "Я нихуя не понял.";
}
const buffer = Buffer.from(response.data, 'binary');
@ -68,4 +70,4 @@ client.on("messageCreate", async function(message){
}
});
client.login('MTI3NDQ2ODg0NDc1NjUzMzM3NA.Gcnpxk.oWowhHvklMrBT1MfWWg_VbM6edb6HrerHAIhnI');
client.login(config.token);