This commit is contained in:
Jonny_Bro (Nikita) 2024-08-13 18:52:55 +05:00
parent 9af053061d
commit 5dceb1abd4
Signed by: jonny_bro
GPG key ID: 3F1ECC04147E9BD8
19 changed files with 872 additions and 708 deletions

View file

@ -48,7 +48,7 @@ class JaBaClient extends Client {
await this.player.extractors.register(YoutubeiExtractor, {
authentication: this.config.youtubeCookie,
streamOptions: {
useClient: "ANDROID",
useClient: "WEB",
},
});

View file

@ -58,7 +58,7 @@ class Addemoji extends BaseCommand {
})
.then(emoji =>
interaction.success("administration/stealemoji:SUCCESS", {
emoji: emoji.name,
emoji: emoji.toString(),
}, { ephemeral: true }),
)
.catch(e => {

View file

@ -47,7 +47,7 @@ class Stealemoji extends BaseCommand {
})
.then(emoji =>
interaction.success("administration/stealemoji:SUCCESS", {
emoji: emoji.name,
emoji: emoji.toString(),
}, { ephemeral: true }),
)
.catch(e => {

View file

@ -23,8 +23,7 @@ class Birthdate extends BaseCommand {
.setDescriptionLocalizations({
uk: client.translate("economy/birthdate:DAY", null, "uk-UA"),
ru: client.translate("economy/birthdate:DAY", null, "ru-RU"),
})
.setRequired(true),
}),
)
.addIntegerOption(option =>
option
@ -34,20 +33,19 @@ class Birthdate extends BaseCommand {
uk: client.translate("economy/birthdate:MONTH", null, "uk-UA"),
ru: client.translate("economy/birthdate:MONTH", null, "ru-RU"),
})
.setRequired(true)
.setChoices(
{ name: client.translate("economy/birthdate:JANUARY"), value: 1 },
{ name: client.translate("economy/birthdate:FEBRUARY"), value: 2 },
{ name: client.translate("economy/birthdate:MARCH"), value: 3 },
{ name: client.translate("economy/birthdate:APRIL"), value: 4 },
{ name: client.translate("economy/birthdate:MAY"), value: 5 },
{ name: client.translate("economy/birthdate:JUNE"), value: 6 },
{ name: client.translate("economy/birthdate:JULY"), value: 7 },
{ name: client.translate("economy/birthdate:AUGUST"), value: 8 },
{ name: client.translate("economy/birthdate:SEPTEMBER"), value: 9 },
{ name: client.translate("economy/birthdate:OCTOBER"), value: 10 },
{ name: client.translate("economy/birthdate:NOVEMBER"), value: 11 },
{ name: client.translate("economy/birthdate:DECEMBER"), value: 12 },
{ name: client.translate("misc:MONTHS:JANUARY"), value: 1 },
{ name: client.translate("misc:MONTHS:FEBRUARY"), value: 2 },
{ name: client.translate("misc:MONTHS:MARCH"), value: 3 },
{ name: client.translate("misc:MONTHS:APRIL"), value: 4 },
{ name: client.translate("misc:MONTHS:MAY"), value: 5 },
{ name: client.translate("misc:MONTHS:JUNE"), value: 6 },
{ name: client.translate("misc:MONTHS:JULY"), value: 7 },
{ name: client.translate("misc:MONTHS:AUGUST"), value: 8 },
{ name: client.translate("misc:MONTHS:SEPTEMBER"), value: 9 },
{ name: client.translate("misc:MONTHS:OCTOBER"), value: 10 },
{ name: client.translate("misc:MONTHS:NOVEMBER"), value: 11 },
{ name: client.translate("misc:MONTHS:DECEMBER"), value: 12 },
),
)
.addIntegerOption(option =>
@ -57,8 +55,16 @@ class Birthdate extends BaseCommand {
.setDescriptionLocalizations({
uk: client.translate("economy/birthdate:YEAR", null, "uk-UA"),
ru: client.translate("economy/birthdate:YEAR", null, "ru-RU"),
})
.setRequired(true),
}),
)
.addBooleanOption(option =>
option
.setName("clear")
.setDescription(client.translate("economy/birthdate:CLEAR"))
.setDescriptionLocalizations({
uk: client.translate("economy/birthdate:CLEAR", null, "uk-UA"),
ru: client.translate("economy/birthdate:CLEAR", null, "ru-RU"),
}),
),
dirname: __dirname,
ownerOnly: false,
@ -71,8 +77,18 @@ class Birthdate extends BaseCommand {
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
async execute(client, interaction) {
const userData = interaction.data.user,
day = interaction.options.getInteger("day"),
const userData = interaction.data.user;
if (interaction.options.getBoolean("clear")) {
userData.birthdate = null;
await userData.save();
return interaction.success("economy/birthdate:SUCCESS", {
date: "none",
});
}
const day = interaction.options.getInteger("day"),
month = interaction.options.getInteger("month"),
year = interaction.options.getInteger("year"),
date = new Date(year, month - 1, day);

View file

@ -28,88 +28,112 @@ class Reminds extends BaseCommand {
async onLoad(client) {
client.on("interactionCreate", async interaction => {
if (!interaction.isButton()) return;
if (!interaction.customId.startsWith("reminds_")) return;
if (interaction.customId.startsWith("reminds_")) {
interaction.data = [];
interaction.data.guild = await client.getGuildData(interaction.guildId);
interaction.data.user = await client.getUserData(interaction.user.id);
interaction.data = [];
interaction.data.guild = await client.getGuildData(interaction.guildId);
interaction.data.user = await client.getUserData(interaction.user.id);
const reminds = interaction.data.user.reminds,
embeds = generateRemindsEmbeds(interaction, reminds);
const reminds = interaction.data.user.reminds,
embeds = generateRemindsEmbeds(interaction, reminds);
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("reminds_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
new ButtonBuilder().setCustomId("reminds_next_page").setStyle(ButtonStyle.Primary).setEmoji("➡️"),
new ButtonBuilder().setCustomId("reminds_jump_page").setStyle(ButtonStyle.Secondary).setEmoji("↗️"),
new ButtonBuilder().setCustomId("reminds_stop").setStyle(ButtonStyle.Danger).setEmoji("❌"),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("reminds_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
new ButtonBuilder().setCustomId("reminds_next_page").setStyle(ButtonStyle.Primary).setEmoji("➡️"),
new ButtonBuilder().setCustomId("reminds_jump_page").setStyle(ButtonStyle.Secondary).setEmoji("↗️"),
new ButtonBuilder().setCustomId("reminds_stop").setStyle(ButtonStyle.Danger).setEmoji("❌"),
);
let currentPage = Number(interaction.message.content.match(/\d+/g)[0]) - 1 ?? 0;
const row2 = new ActionRowBuilder();
for (const key in reminds) {
row2.addComponents(
new ButtonBuilder()
.setCustomId(`reminds_delete_${key}`)
.setLabel(interaction.translate("general/reminds:DELETE", { pos: parseInt(key) + 1 }))
.setStyle(ButtonStyle.Danger),
);
}
let currentPage = Number(interaction.message.content.match(/\d+/g)[0]) - 1 ?? 0;
if (interaction.customId === "reminds_prev_page") {
await interaction.deferUpdate();
if (interaction.customId === "reminds_prev_page") {
await interaction.deferUpdate();
if (currentPage !== 0) {
--currentPage;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row],
});
}
} else if (interaction.customId === "reminds_next_page") {
await interaction.deferUpdate();
if (currentPage < embeds.length - 1) {
currentPage++;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row],
});
}
} else if (interaction.customId === "reminds_jump_page") {
await interaction.deferUpdate();
const msg = await interaction.followUp({
content: interaction.translate("misc:JUMP_TO_PAGE", {
length: embeds.length,
}),
fetchReply: true,
});
const filter = res => {
return res.author.id === interaction.user.id && !isNaN(res.content);
};
interaction.channel.awaitMessages({ filter, max: 1, time: 10 * 1000 }).then(collected => {
if (embeds[collected.first().content - 1]) {
currentPage = collected.first().content - 1;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row],
});
if (collected.first().deletable) collected.first().delete();
if (msg.deletable) msg.delete();
} else {
if (collected.first().deletable) collected.first().delete();
if (msg.deletable) msg.delete();
return;
}
});
} else if (interaction.customId === "reminds_stop") {
await interaction.deferUpdate();
row.components.forEach(component => {
component.setDisabled(true);
});
return interaction.editReply({
components: [row],
if (currentPage !== 0) {
--currentPage;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row, row2],
});
}
} else if (interaction.customId === "reminds_next_page") {
await interaction.deferUpdate();
if (currentPage < embeds.length - 1) {
currentPage++;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row, row2],
});
}
} else if (interaction.customId === "reminds_jump_page") {
await interaction.deferUpdate();
const msg = await interaction.followUp({
content: interaction.translate("misc:JUMP_TO_PAGE", {
length: embeds.length,
}),
fetchReply: true,
});
const filter = res => {
return res.author.id === interaction.user.id && !isNaN(res.content);
};
interaction.channel.awaitMessages({ filter, max: 1, time: 10 * 1000 }).then(collected => {
if (embeds[collected.first().content - 1]) {
currentPage = collected.first().content - 1;
interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]],
components: [row, row2],
});
if (collected.first().deletable) collected.first().delete();
if (msg.deletable) msg.delete();
} else {
if (collected.first().deletable) collected.first().delete();
if (msg.deletable) msg.delete();
return;
}
});
} else if (interaction.customId === "reminds_stop") {
await interaction.deferUpdate();
row.components.forEach(component => {
component.setDisabled(true);
});
return interaction.editReply({
components: [row, row2],
});
} else if (interaction.customId.startsWith("reminds_delete_")) {
await interaction.deferUpdate();
const id = parseInt(interaction.customId.split("_")[2]);
const remindToDelete = reminds[id];
interaction.data.user.reminds = reminds.filter(r => r.sendAt !== remindToDelete.sendAt);
await interaction.data.user.save();
return interaction.followUp({
content: `${client.customEmojis.success} | ${interaction.translate("general/reminds:DELETED", { pos: id + 1 })}`,
ephemeral: true,
});
}
});
}
@ -134,10 +158,21 @@ class Reminds extends BaseCommand {
new ButtonBuilder().setCustomId("reminds_stop").setStyle(ButtonStyle.Danger).setEmoji("❌"),
);
const row2 = new ActionRowBuilder();
for (const key in reminds) {
row2.addComponents(
new ButtonBuilder()
.setCustomId(`reminds_delete_${key}`)
.setLabel(interaction.translate("general/reminds:DELETE", { pos: parseInt(key) + 1 }))
.setStyle(ButtonStyle.Danger),
);
}
await interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **1**/**${embeds.length}**`,
embeds: [embeds[0]],
components: [row],
components: [row, row2],
ephemeral: true,
});
}

View file

@ -23,8 +23,7 @@ class Skip extends BaseCommand {
.setDescriptionLocalizations({
uk: client.translate("music/skip:POSITION", null, "uk-UA"),
ru: client.translate("music/skip:POSITION", null, "ru-RU"),
})
.setRequired(false),
}),
),
dirname: __dirname,
ownerOnly: false,

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, PermissionsBitField, ButtonBuilder, ButtonStyle, ActionRowBuilder, ChannelType } = require("discord.js");
const { SlashCommandBuilder, PermissionsBitField, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class CreateTicketEmbed extends BaseCommand {
@ -22,186 +22,6 @@ class CreateTicketEmbed extends BaseCommand {
});
}
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad(client) {
client.on("interactionCreate", async interaction => {
if (!interaction.isButton()) return;
interaction.data = [];
interaction.data.guild = await client.getGuildData(interaction.guildId);
const button = interaction.component;
if (button.customId === "support_ticket") {
const guildData = interaction.data.guild,
ticketsCategory = guildData.plugins.tickets.ticketsCategory,
ticketLogs = guildData.plugins.tickets.ticketLogs;
if (interaction.guild.channels.cache.get(ticketsCategory).children.cache.size >= 50) {
const sorted = interaction.guild.channels.cache.get(ticketsCategory).children.cache.sort((ch1, ch2) => ch1.createdTimestamp - ch2.createdTimestamp);
await sorted.first().delete();
}
if (guildData.plugins.tickets.count === undefined) guildData.plugins.tickets.count = 0;
guildData.plugins.tickets.count++;
const channel = await interaction.guild.channels.create({
name: `${interaction.user.username}-support-${guildData.plugins.tickets.count}`,
topic: interaction.user.id,
type: ChannelType.GuildText,
parent: ticketsCategory,
permissionOverwrites: [
{
id: interaction.user.id,
allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages],
},
{
id: interaction.guild.roles.everyone,
deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages],
},
],
});
const logChannel = interaction.guild.channels.cache.get(ticketLogs);
const logEmbed = client.embed({
title: interaction.translate("tickets/createticketembed:TICKET_CREATED_TITLE"),
description: `${interaction.user.toString()} (${channel.toString()})`,
});
await logChannel.send({ embeds: [logEmbed] });
await interaction.success("tickets/createticketembed:TICKET_CREATED", {
channel: channel.toString(),
}, { ephemeral: true });
await channel.send(`<@${interaction.user.id}>`);
const embed = client.embed({
author: {
name: interaction.user.getUsername(),
iconURL: interaction.user.displayAvatarURL(),
},
title: "Support Ticket",
description: interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC"),
});
const closeButton = new ButtonBuilder()
.setCustomId("close_ticket")
.setLabel(interaction.translate("tickets/closeticket:CLOSE_TICKET"))
.setStyle(ButtonStyle.Danger);
const transcriptButton = new ButtonBuilder()
.setCustomId("transcript_ticket")
.setLabel(interaction.translate("tickets/closeticket:TRANSCRIPT_TICKET"))
.setStyle(ButtonStyle.Secondary);
const row = new ActionRowBuilder().addComponents(closeButton, transcriptButton);
await guildData.save();
await channel.send({ embeds: [embed], components: [row] });
} else if (button.customId === "close_ticket") {
const embed = client.embed({
title: interaction.translate("tickets/closeticket:CLOSING_TITLE"),
description: interaction.translate("tickets/closeticket:CLOSING_DESC"),
fields: [
{
name: interaction.translate("common:TICKET"),
value: interaction.channel.name,
},
{
name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(),
},
],
});
const button = new ButtonBuilder().setCustomId("cancel_closing").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder().addComponents(button);
await interaction.reply({
embeds: [embed],
components: [row],
});
const filter = i => i.customId === "cancel_closing";
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 5000 });
collector.on("collect", async i => {
await i.update({ content: interaction.translate("tickets/closeticket:CLOSING_CANCELED"), components: [] });
collector.stop("canceled");
});
collector.on("end", async (_, reason) => {
if (reason !== "canceled") {
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot),
messages = Array.from(reversedMessages.values()).reverse(),
transcriptionLogs = interaction.data.guild.plugins.tickets.transcriptionLogs,
ticketLogs = interaction.data.guild.plugins.tickets.ticketLogs;
if (messages.length > 1) {
let transcript = "---- TICKET CREATED ----\n";
messages.forEach(message => {
transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
});
transcript += "---- TICKET CLOSED ----\n";
if (transcriptionLogs !== null) interaction.guild.channels.cache.get(transcriptionLogs).send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] });
try {
await interaction.user.send({
content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: interaction.channel.name }),
files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
});
} catch (e) {
interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
}
}
const logChannel = interaction.guild.channels.cache.get(ticketLogs);
const logEmbed = client.embed({
title: interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"),
description: `${interaction.user.toString()} (${interaction.channel.toString()})`,
});
logChannel.send({ embeds: [logEmbed] });
interaction.channel.send("Closed!");
const member = interaction.guild.members.cache.find(u => u.user.id === interaction.channel.topic);
await interaction.channel.permissionOverwrites.edit(member, { ViewChannel: false, SendMessages: null });
await interaction.channel.setName(`${interaction.channel.name}-closed`);
}
});
} else if (button.customId === "transcript_ticket") {
await interaction.deferUpdate();
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
const messages = Array.from(reversedMessages.values()).reverse();
if (messages.length > 1) {
let transcript = "---- TICKET CREATED ----\n";
messages.forEach(message => {
transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
});
transcript += "---- TICKET CLOSED ----\n";
try {
await interaction.user.send({
content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }),
files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
});
} catch (error) {
interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
}
} else return;
}
});
}
/**
*
* @param {import("../../base/Client")} client

View file

@ -14,13 +14,7 @@ module.exports = {
clientSecret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
},
/* YouTube Cookie */
youtubeCookie: {
access_token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
refresh_token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
scope: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
token_type: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
expiry_date: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
},
youtubeCookie: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
/* Support server */
support: {
id: "123456789098765432", // The ID of the support server

192
events/TicketsButton.js Normal file
View file

@ -0,0 +1,192 @@
const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType, PermissionsBitField } = require("discord.js");
const BaseEvent = require("../base/BaseEvent");
class CommandHandler extends BaseEvent {
constructor() {
super({
name: "interactionCreate",
once: false,
});
}
/**
*
* @param {import("../base/Client")} client
* @param {import("discord.js").ButtonInteraction} interaction
*/
async execute(client, interaction) {
if (!interaction.isButton()) return;
if (!interaction.customId.startsWith("ticket_")) return;
const button = interaction.component;
interaction.data = [];
interaction.data.guild = await client.getGuildData(interaction.guildId);
if (button.customId === "ticket_create") {
const guildData = interaction.data.guild,
ticketsCategory = guildData.plugins.tickets.ticketsCategory,
ticketLogs = guildData.plugins.tickets.ticketLogs;
if (interaction.guild.channels.cache.get(ticketsCategory).children.cache.size >= 50) {
const sorted = interaction.guild.channels.cache.get(ticketsCategory).children.cache.sort((ch1, ch2) => ch1.createdTimestamp - ch2.createdTimestamp);
await sorted.first().delete();
}
if (guildData.plugins.tickets.count === undefined) guildData.plugins.tickets.count = 0;
const channel = await interaction.guild.channels.create({
name: `${interaction.user.username}-support-${guildData.plugins.tickets.count}`,
topic: interaction.user.id,
type: ChannelType.GuildText,
parent: ticketsCategory,
permissionOverwrites: [
{
id: interaction.user.id,
allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages],
},
{
id: interaction.guild.roles.everyone,
deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages],
},
],
});
const logChannel = interaction.guild.channels.cache.get(ticketLogs);
const logEmbed = client.embed({
title: interaction.translate("tickets/createticketembed:TICKET_CREATED_TITLE"),
description: `${interaction.user.toString()} (${channel.toString()})`,
});
await logChannel.send({ embeds: [logEmbed] });
await interaction.success("tickets/createticketembed:TICKET_CREATED", {
channel: channel.toString(),
}, { ephemeral: true });
await channel.send(`<@${interaction.user.id}>`);
const embed = client.embed({
author: {
name: interaction.user.getUsername(),
iconURL: interaction.user.displayAvatarURL(),
},
title: "Support Ticket",
description: interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC"),
});
const closeButton = new ButtonBuilder()
.setCustomId("close_ticket")
.setLabel(interaction.translate("tickets/closeticket:CLOSE_TICKET"))
.setStyle(ButtonStyle.Danger);
const transcriptButton = new ButtonBuilder()
.setCustomId("transcript_ticket")
.setLabel(interaction.translate("tickets/closeticket:TRANSCRIPT_TICKET"))
.setStyle(ButtonStyle.Secondary);
const row = new ActionRowBuilder().addComponents(closeButton, transcriptButton);
guildData.plugins.tickets.count++;
await guildData.save();
await channel.send({ embeds: [embed], components: [row] });
} else if (button.customId === "ticket_close") {
const embed = client.embed({
title: interaction.translate("tickets/closeticket:CLOSING_TITLE"),
description: interaction.translate("tickets/closeticket:CLOSING_DESC"),
fields: [
{
name: interaction.translate("common:TICKET"),
value: interaction.channel.name,
},
{
name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(),
},
],
});
const button = new ButtonBuilder().setCustomId("cancel_closing").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder().addComponents(button);
await interaction.reply({
embeds: [embed],
components: [row],
});
const filter = i => i.customId === "cancel_closing";
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 5000 });
collector.on("collect", async i => {
await i.update({ content: interaction.translate("tickets/closeticket:CLOSING_CANCELED"), components: [] });
collector.stop("canceled");
});
collector.on("end", async (_, reason) => {
if (reason !== "canceled") {
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot),
messages = Array.from(reversedMessages.values()).reverse(),
transcriptionLogs = interaction.data.guild.plugins.tickets.transcriptionLogs,
ticketLogs = interaction.data.guild.plugins.tickets.ticketLogs;
if (messages.length > 1) {
let transcript = "---- TICKET CREATED ----\n";
messages.forEach(message => {
transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
});
transcript += "---- TICKET CLOSED ----\n";
if (transcriptionLogs !== null) interaction.guild.channels.cache.get(transcriptionLogs).send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] });
try {
await interaction.user.send({
content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: interaction.channel.name }),
files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
});
} catch (e) {
interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
}
}
const logChannel = interaction.guild.channels.cache.get(ticketLogs);
const logEmbed = client.embed({
title: interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"),
description: `${interaction.user.toString()} (${interaction.channel.toString()})`,
});
logChannel.send({ embeds: [logEmbed] });
interaction.channel.send("Closed!");
const member = interaction.guild.members.cache.find(u => u.user.id === interaction.channel.topic);
await interaction.channel.permissionOverwrites.edit(member, { ViewChannel: false, SendMessages: null });
await interaction.channel.setName(`${interaction.channel.name}-closed`);
}
});
} else if (button.customId === "ticket_transcript") {
await interaction.deferUpdate();
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
const messages = Array.from(reversedMessages.values()).reverse();
if (messages.length > 1) {
let transcript = "---- TICKET CREATED ----\n";
messages.forEach(message => {
transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
});
transcript += "---- TICKET CLOSED ----\n";
try {
await interaction.user.send({
content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }),
files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
});
} catch (error) {
interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
}
} else return;
}
}
}
module.exports = CommandHandler;

View file

@ -8,7 +8,7 @@
"MODLOGS": "Moderation Logs",
"REPORTS": "Reports",
"SUGGESTIONS": "Suggestions",
"TICKETSCATEGORY": "Category For Tickets (They have folder icon)",
"TICKETSCATEGORY": "Category For Tickets (They have a 'folder' icon)",
"TICKETS_NOT_CATEGORY": "Please select a **category** channel",
"TICKETLOGS": "Tickets Logs",
"TRANSCRIPTIONLOGS": "Transcripts Logs",

View file

@ -5,23 +5,11 @@
"DAY": "Day",
"MONTH": "Month",
"YEAR": "Year",
"CLEAR": "Clear date?",
"INVALID_DATE": "Invalid date provided",
"DATE_TOO_LOW": "Are you over 80 years old? :eyes:",
"DATE_TOO_HIGH": "Hmm... You haven't been born yet",
"HAPPY_BIRTHDAY": "Happy Birthday",
"HAPPY_BIRTHDAY_MESSAGE": "Happy birthday to <@{{user}}>! Today, they have turned {{age}}!",
"SUCCESS": "Your date of birth has been set to **{{date}}**",
"JANUARY": "January",
"FEBRUARY": "February",
"MARCH": "March",
"APRIL": "April",
"MAY": "May",
"JUNE": "June",
"JULY": "July",
"AUGUST": "August",
"SEPTEMBER": "September",
"OCTOBER": "October",
"NOVEMBER": "November",
"DECEMBER": "December"
"SUCCESS": "Your date of birth has been set to **{{date}}**"
}

View file

@ -3,5 +3,7 @@
"USAGE": "",
"EXAMPLES": "reminds",
"NO_REMINDS": "No reminds found",
"REMINDS_LIST": "Reminds List"
"REMINDS_LIST": "Reminds List",
"DELETE": "Delete {{pos}}",
"DELETED": "Deleted remind №{{pos}}"
}

View file

@ -22,6 +22,21 @@
"QUOTE_JUMP": "Jump to",
"QUOTE_FOOTER": "Quoted by {{user}}",
"MONTHS": {
"JANUARY": "January",
"FEBRUARY": "February",
"MARCH": "March",
"APRIL": "April",
"MAY": "May",
"JUNE": "June",
"JULY": "July",
"AUGUST": "August",
"SEPTEMBER": "September",
"OCTOBER": "October",
"NOVEMBER": "November",
"DECEMBER": "December"
},
"MONITORING": {
"DELETE": {
"TITLE": "{{user}} deleted a message!",

View file

@ -5,23 +5,11 @@
"DAY": "День",
"MONTH": "Месяц",
"YEAR": "Год",
"CLEAR": "Очистить дату?",
"INVALID_DATE": "Указана неверная дата",
"DATE_TOO_LOW": "Вам больше 80 лет? :eyes:",
"DATE_TOO_HIGH": "Хммм... Вы ещё не родились",
"HAPPY_BIRTHDAY": "День рождения",
"HAPPY_BIRTHDAY_MESSAGE": "Поздравляем <@{{user}}> с днём рождения! Сегодня ему(ей) исполнилось {{age}}!",
"SUCCESS": "Ваша дата рождения установлена на **{{date}}**",
"JANUARY": "Январь",
"FEBRUARY": "Февраль",
"MARCH": "Март",
"APRIL": "Апрель",
"MAY": "Май",
"JUNE": "Июнь",
"JULY": "Июль",
"AUGUST": "Август",
"SEPTEMBER": "Сентябрь",
"OCTOBER": "Октябрь",
"NOVEMBER": "Ноябрь",
"DECEMBER": "Декабрь"
"SUCCESS": "Ваша дата рождения установлена на **{{date}}**"
}

View file

@ -22,6 +22,21 @@
"QUOTE_JUMP": "Перейти к",
"QUOTE_FOOTER": "Цитировал {{user}}",
"MONTHS": {
"JANUARY": "Январь",
"FEBRUARY": "Февраль",
"MARCH": "Март",
"APRIL": "Апрель",
"MAY": "Май",
"JUNE": "Июнь",
"JULY": "Июль",
"AUGUST": "Август",
"SEPTEMBER": "Сентябрь",
"OCTOBER": "Октябрь",
"NOVEMBER": "Ноябрь",
"DECEMBER": "Декабрь"
},
"MONITORING": {
"DELETE": {
"TITLE": "{{user}} удалил сообщение!",

View file

@ -5,23 +5,11 @@
"DAY": "День",
"MONTH": "Місяць",
"YEAR": "Рік",
"CLEAR": "Очистити дату?",
"INVALID_DATE": "Вказана неправильна дата",
"DATE_TOO_LOW": "Вам більше 80 років? :eyes:",
"DATE_TOO_HIGH": "Хммм... Ви ще не народилися",
"HAPPY_BIRTHDAY": "День народження",
"HAPPY_BIRTHDAY_MESSAGE": "Вітаємо <@{{user}}> з днем народження! Сьогодні йому виповнилося {{age}}",
"SUCCESS": "Вашу дату народження встановлено на **{{date}}**",
"JANUARY": "Січень",
"FEBRUARY": "Лютий",
"MARCH": "Березень",
"APRIL": "Квітень",
"MAY": "Травень",
"JUNE": "Червень",
"JULY": "Липень",
"AUGUST": "Серпень",
"SEPTEMBER": "Вересень",
"OCTOBER": "Жовтень",
"NOVEMBER": "Листопад",
"DECEMBER": "Грудень"
"SUCCESS": "Вашу дату народження встановлено на **{{date}}**"
}

View file

@ -22,6 +22,21 @@
"QUOTE_JUMP": "Перейти до",
"QUOTE_FOOTER": "Цитував {{user}}",
"MONTHS": {
"JANUARY": "Січень",
"FEBRUARY": "Лютий",
"MARCH": "Березень",
"APRIL": "Квітень",
"MAY": "Травень",
"JUNE": "Червень",
"JULY": "Липень",
"AUGUST": "Серпень",
"SEPTEMBER": "Вересень",
"OCTOBER": "Жовтень",
"NOVEMBER": "Листопад",
"DECEMBER": "Грудень"
},
"MONITORING": {
"DELETE": {
"TITLE": "{{user}} видалив повідомлення!",

View file

@ -1,6 +1,6 @@
{
"name": "jaba",
"version": "4.6.1",
"version": "4.6.3",
"description": "My Discord Bot",
"main": "index.js",
"scripts": {
@ -8,17 +8,17 @@
},
"author": "@jonny_bro",
"dependencies": {
"@discord-player/extractor": "^4.5.0",
"@discord-player/extractor": "^4.5.1",
"@discordjs/opus": "^0.9.0",
"@discordjs/rest": "^2.3.0",
"@discordjs/voice": "^0.17.0",
"@napi-rs/canvas": "^0.1.53",
"chalk": "^4.1.2",
"cron": "^2.4.4",
"discord-api-types": "^0.37.92",
"discord-api-types": "^0.37.93",
"discord-giveaways": "^6.0.1",
"discord-player": "^6.7.1",
"discord-player-youtubei": "^1.2.4",
"discord-player-youtubei": "^1.2.6",
"discord.js": "^14.15.3",
"gamedig": "^4.1.0",
"i18next": "^21.10.0",
@ -27,8 +27,7 @@
"moment": "^2.29.4",
"mongoose": "^7.6.3",
"ms": "^2.1.3",
"node-fetch": "^2.7.0",
"ytdl-core": "^4.11.5"
"node-fetch": "^2.7.0"
},
"devDependencies": {
"eslint": "^8.56.0"

File diff suppressed because it is too large Load diff