diff --git a/config.example.json b/config.example.json new file mode 100644 index 0000000..c1f6993 --- /dev/null +++ b/config.example.json @@ -0,0 +1,4 @@ +{ + "token": "Token", + "ALLOWED_IDS": ["1266775948548903026", "1151129960141037659", "1275008490959667234", "1234866477086019648", "1277611369578889277", "1242022836529266708", "1275098630059200586", "1277311957405405296", "1277936618749300760", "1275899048171409528"] +} \ No newline at end of file diff --git a/index.js b/index.js index 8e37d00..51d0aa4 100644 --- a/index.js +++ b/index.js @@ -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'); \ No newline at end of file +client.login(config.token); \ No newline at end of file