Compare commits
4 Commits
15cf28be75
...
96df07b735
Author | SHA1 | Date | |
---|---|---|---|
96df07b735 | |||
ea94b99813 | |||
d6b7498a02 | |||
6916446b11 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -130,3 +130,4 @@ dist
|
|||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
config.json
|
24
index.js
24
index.js
@ -1,10 +1,10 @@
|
|||||||
const { error } = require('console');
|
const { error } = require("console");
|
||||||
const { Client, Message, MessageAttachment } = require('discord.js-selfbot-v13');
|
const { Client, Message, MessageAttachment } = require("discord.js-selfbot-v13");
|
||||||
const axios = require('axios');
|
const axios = require("axios");
|
||||||
const config = require('./config.json');
|
const config = require("./config.json");
|
||||||
const client = new Client();
|
const client = new Client();
|
||||||
|
|
||||||
client.on('ready', async () => {
|
client.on("ready", async () => {
|
||||||
console.log(`${client.user.username} is ready!`);
|
console.log(`${client.user.username} is ready!`);
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -22,31 +22,31 @@ async function getMessageContent(message) {
|
|||||||
const attachment = message.attachments.first();
|
const attachment = message.attachments.first();
|
||||||
|
|
||||||
if (!attachment.url) {
|
if (!attachment.url) {
|
||||||
console.error('URL вложения не найден.');
|
console.error("URL вложения не найден.");
|
||||||
return "Я нихуя не понял.";
|
return "Я нихуя не понял.";
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await axios.get(attachment.url, { responseType: 'arraybuffer' });
|
const response = await axios.get(attachment.url, { responseType: "arraybuffer" });
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
console.error('Ошибка: response.data is undefined.');
|
console.error("Ошибка: response.data is undefined.");
|
||||||
return "Я нихуя не понял.";
|
return "Я нихуя не понял.";
|
||||||
}
|
}
|
||||||
|
|
||||||
const buffer = Buffer.from(response.data, 'binary');
|
const buffer = Buffer.from(response.data, "binary");
|
||||||
const file = new MessageAttachment(buffer, attachment.name);
|
const file = new MessageAttachment(buffer, attachment.name);
|
||||||
|
|
||||||
if (message.content) return { content: `${message.author.displayName}: ${message.content} `, files: [file] };
|
if (message.content) return { content: `${message.author.displayName}: ${message.content} `, files: [file] };
|
||||||
else return {files: [file]};
|
else return {files: [file]};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Ошибка при получении файла:', error.message);
|
console.error("Ошибка при получении файла:", error.message);
|
||||||
return message.author.displayName + ": " + message.content + " ";
|
return "Я нихуя не понял.";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!message.reference) return message.author.displayName + ": " + message.content;
|
if (!message.reference) return message.author.displayName + ": " + message.content;
|
||||||
else {
|
else {
|
||||||
let reply = message.channel.messages.fetch(message.reference.messageId);
|
let reply = message.channel.messages.fetch(message.reference.messageId);
|
||||||
return message.author.displayName + ": " + message.content + " `Ответ на: " + reply.author.displayName + ": " + reply.content + "`";
|
return `${message.author.displayName}: ${message.content} \`Ответ на: ${reply.author.displayName}: + ${reply.content}\``;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user