This commit is contained in:
Jonny_Bro (Nikita) 2023-04-30 16:57:02 +05:00
parent fa6c3f2487
commit 7ac48975c1
3 changed files with 65 additions and 1 deletions

View file

@ -1,3 +1,7 @@
### JaBa v4.2.4
* Добавлено
* Бот цитирует сообщение если отправлена ссылка на него.
### JaBa v4.2.3
* Удалено
* Команда *chat* - Я передумал, а вы даже и не заметили =)

View file

@ -1,4 +1,4 @@
const { PermissionsBitField } = require("discord.js");
const { PermissionsBitField, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const BaseEvent = require("../base/BaseEvent"),
xpCooldown = {},
usersMap = new Map(),
@ -49,6 +49,61 @@ class MessageCreate extends BaseEvent {
if (message.guild) {
await updateXp(client, message, data);
if (message.content.includes("discord.com/channels/")) {
const ids = message.content.match(/\d+/g);
const channelId = ids[1],
messageId = ids[2];
const msg = await client.channels.cache.get(channelId).messages.fetch(messageId);
const embed = new EmbedBuilder()
.setAuthor({
name: message.translate("misc:QUOTE_TITLE", {
user: msg.author.tag,
}),
iconURL: "https://wynem.com/assets/images/icons/quote.webp",
})
.setThumbnail(msg.author.avatarURL())
.setDescription(msg.content !== "" ? msg.content : `*${message.translate("common:MISSING")}*`)
.addFields([
{
name: message.translate("misc:QUOTE_ATTACHED"),
value: msg.attachments.size > 0 ? msg.attachments.map(a => {
return `[${a.name}](${a.url})`;
}).join("\n") : `*${message.translate("common:MISSING")}*`,
},
])
.setFooter({
text: message.translate("misc:QUOTE_FOOTER", { user: message.author.tag }),
})
.setColor(client.config.embed.color)
.setTimestamp(msg.createdTimestamp);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel(message.translate("misc:QUOTE_JUMP"))
.setStyle(ButtonStyle.Link)
.setURL(msg.url),
new ButtonBuilder()
.setCustomId("quote_delete")
.setEmoji("1102200816582000750")
.setStyle(ButtonStyle.Danger),
);
const reply = await message.reply({
embeds: [embed],
components: [row],
});
const filter = i => i.user.id === message.author.id;
const collector = message.channel.createMessageComponentCollector({ filter, time: (60 * 1000) });
collector.on("collect", async i => {
if (i.isButton() && i.customId === "quote_delete")
if (reply.deletable) await reply.delete();
});
}
if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channel.id))
if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content))
if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) {

View file

@ -15,6 +15,11 @@
"TIMED_OUT": "Время вышло",
"JUMP_TO_PAGE": "Укажите страницу к которой хотите перейти (максимум **{{length}}**):",
"QUOTE_TITLE": "Сообщение от {{user}}",
"QUOTE_ATTACHED": "Прикреплённые файлы",
"QUOTE_JUMP": "Перейти",
"QUOTE_FOOTER": "Цитировал {{user}}",
"PERMISSIONS": {
"CreateInstantInvite": "Создание приглашения",
"KickMembers": "Выгонять участников",