mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
change domain + rewrite quotes
This commit is contained in:
parent
f7c1245f61
commit
f1366cc9ec
6 changed files with 46 additions and 21 deletions
|
@ -47,7 +47,7 @@ class Shorturl extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const url = interaction.options.getString("url");
|
const url = interaction.options.getString("url");
|
||||||
const res = await fetch(`http://jababot.ru/yourls/yourls-api.php?signature=${client.config.apiKeys.jababot_yourls}&action=shorturl&url=${encodeURIComponent(url)}&format=json`).then(res => res.json());
|
const res = await fetch(`http://plsgo.ru/yourls-api.php?signature=${client.config.apiKeys.jababot_yourls}&action=shorturl&url=${encodeURIComponent(url)}&format=json`).then(res => res.json());
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: `<${res.shorturl}>`,
|
content: `<${res.shorturl}>`,
|
||||||
|
|
|
@ -39,7 +39,7 @@ class MessageCreate extends BaseEvent {
|
||||||
if (message.guild) {
|
if (message.guild) {
|
||||||
await updateXp(client, message, data.memberData);
|
await updateXp(client, message, data.memberData);
|
||||||
|
|
||||||
if (message.content.includes("discord.com/channels/")) {
|
if (message.content.match(/(https|http):\/\/(ptb\.|canary\.)?(discord.com)\/(channels)\/\d+\/\d+\/\d+/g)) {
|
||||||
const link = message.content.match(/(https|http):\/\/(ptb\.|canary\.)?(discord.com)\/(channels)\/\d+\/\d+\/\d+/g)[0],
|
const link = message.content.match(/(https|http):\/\/(ptb\.|canary\.)?(discord.com)\/(channels)\/\d+\/\d+\/\d+/g)[0],
|
||||||
ids = link.match(/\d+/g),
|
ids = link.match(/\d+/g),
|
||||||
channelId = ids[1],
|
channelId = ids[1],
|
||||||
|
@ -54,32 +54,34 @@ class MessageCreate extends BaseEvent {
|
||||||
iconURL: "https://wynem.com/assets/images/icons/quote.webp",
|
iconURL: "https://wynem.com/assets/images/icons/quote.webp",
|
||||||
})
|
})
|
||||||
.setThumbnail(msg.author.displayAvatarURL())
|
.setThumbnail(msg.author.displayAvatarURL())
|
||||||
.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({
|
.setFooter({
|
||||||
text: message.translate("misc:QUOTE_FOOTER", { user: message.author.getUsername() }),
|
text: message.translate("misc:QUOTE_FOOTER", { user: message.author.getUsername() }),
|
||||||
})
|
})
|
||||||
.setColor(client.config.embed.color)
|
.setColor(client.config.embed.color)
|
||||||
.setTimestamp(msg.createdTimestamp);
|
.setTimestamp(msg.createdTimestamp);
|
||||||
|
|
||||||
|
if (msg.content !== "") embed.addFields([
|
||||||
|
{
|
||||||
|
name: message.translate("misc:QUOTE_CONTENT"),
|
||||||
|
value: msg.content,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (msg.attachments.size > 0) {
|
||||||
|
embed.addFields([
|
||||||
|
{
|
||||||
|
name: message.translate("misc:QUOTE_ATTACHED"),
|
||||||
|
value: msg.attachments.map(a => { return `[${a.name}](${a.url})`; }).join(", "),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
const row = new ActionRowBuilder().addComponents(
|
const row = new ActionRowBuilder().addComponents(
|
||||||
new ButtonBuilder().setLabel(message.translate("misc:QUOTE_JUMP")).setStyle(ButtonStyle.Link).setURL(msg.url),
|
new ButtonBuilder().setLabel(message.translate("misc:QUOTE_JUMP")).setStyle(ButtonStyle.Link).setURL(msg.url),
|
||||||
new ButtonBuilder().setCustomId("quote_delete").setEmoji("1102200816582000750").setStyle(ButtonStyle.Danger),
|
new ButtonBuilder().setCustomId("quote_delete").setEmoji("1102200816582000750").setStyle(ButtonStyle.Danger),
|
||||||
);
|
);
|
||||||
|
|
||||||
const reply = await message.reply({
|
await message.reply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: [row],
|
components: [row],
|
||||||
});
|
});
|
||||||
|
@ -88,7 +90,11 @@ class MessageCreate extends BaseEvent {
|
||||||
const collector = message.channel.createMessageComponentCollector({ filter, time: 60 * 1000 });
|
const collector = message.channel.createMessageComponentCollector({ filter, time: 60 * 1000 });
|
||||||
|
|
||||||
collector.on("collect", async i => {
|
collector.on("collect", async i => {
|
||||||
if (i.isButton() && i.customId === "quote_delete") if (reply.deletable) reply.delete();
|
if (i.isButton() && i.customId === "quote_delete") {
|
||||||
|
console.log(i.message);
|
||||||
|
|
||||||
|
if (i.message.deletable) i.message.delete();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,22 @@ module.exports.init = async function (client) {
|
||||||
client.databaseCache.users.delete(u.id);
|
client.databaseCache.users.delete(u.id);
|
||||||
client.usersData.deleteOne({ id: u.id });
|
client.usersData.deleteOne({ id: u.id });
|
||||||
client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
|
client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
|
||||||
|
|
||||||
|
client.usersData.save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.membersData.find({}, function (err, res) {
|
||||||
|
for (const user of res) {
|
||||||
|
client.users.fetch(user.id).then(u => {
|
||||||
|
if (u.username.match(/.*Deleted User.* [A-z0-9]+/g)) {
|
||||||
|
client.databaseCache.members.delete(u.id);
|
||||||
|
client.membersData.deleteOne({ id: u.id });
|
||||||
|
client.logger.log(`Removed from database deleted user - ID: ${u.id} Username: ${u.username}`);
|
||||||
|
|
||||||
|
client.membersData.save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
"TIMED_OUT": "Time out.",
|
"TIMED_OUT": "Time out.",
|
||||||
"JUMP_TO_PAGE": "Specify the page you want to jump to (maximum **{{length}}**):",
|
"JUMP_TO_PAGE": "Specify the page you want to jump to (maximum **{{length}}**):",
|
||||||
"QUOTE_TITLE": "Message from {{user}}",
|
"QUOTE_TITLE": "Message from {{user}}",
|
||||||
|
"QUOTE_CONTENT": "Content",
|
||||||
"QUOTE_ATTACHED": "Attached files",
|
"QUOTE_ATTACHED": "Attached files",
|
||||||
"QUOTE_JUMP": "Jump",
|
"QUOTE_JUMP": "Jump to",
|
||||||
"QUOTE_FOOTER": "Quoted by {{user}}",
|
"QUOTE_FOOTER": "Quoted by {{user}}",
|
||||||
|
|
||||||
"PERMISSIONS": {
|
"PERMISSIONS": {
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
"TIMED_OUT": "Время вышло",
|
"TIMED_OUT": "Время вышло",
|
||||||
"JUMP_TO_PAGE": "Укажите страницу к которой хотите перейти (максимум **{{length}}**):",
|
"JUMP_TO_PAGE": "Укажите страницу к которой хотите перейти (максимум **{{length}}**):",
|
||||||
"QUOTE_TITLE": "Сообщение от {{user}}",
|
"QUOTE_TITLE": "Сообщение от {{user}}",
|
||||||
|
"QUOTE_CONTENT": "Содержимое",
|
||||||
"QUOTE_ATTACHED": "Прикреплённые файлы",
|
"QUOTE_ATTACHED": "Прикреплённые файлы",
|
||||||
"QUOTE_JUMP": "Перейти",
|
"QUOTE_JUMP": "Перейти к",
|
||||||
"QUOTE_FOOTER": "Цитировал {{user}}",
|
"QUOTE_FOOTER": "Цитировал {{user}}",
|
||||||
|
|
||||||
"PERMISSIONS": {
|
"PERMISSIONS": {
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
"TIMED_OUT": "Час вийшов",
|
"TIMED_OUT": "Час вийшов",
|
||||||
"JUMP_TO_PAGE": "Вкажіть сторінку, до якої хочете перейти (максимум **{{length}}**):",
|
"JUMP_TO_PAGE": "Вкажіть сторінку, до якої хочете перейти (максимум **{{length}}**):",
|
||||||
"QUOTE_TITLE": "Повідомлення від {{user}}",
|
"QUOTE_TITLE": "Повідомлення від {{user}}",
|
||||||
|
"QUOTE_CONTENT": "Вміст",
|
||||||
"QUOTE_ATTACHED": "Прикріплені файли",
|
"QUOTE_ATTACHED": "Прикріплені файли",
|
||||||
"QUOTE_JUMP": "Перейти",
|
"QUOTE_JUMP": "Перейти до",
|
||||||
"QUOTE_FOOTER": "Цитував {{user}}",
|
"QUOTE_FOOTER": "Цитував {{user}}",
|
||||||
|
|
||||||
"PERMISSIONS": {
|
"PERMISSIONS": {
|
||||||
|
|
Loading…
Reference in a new issue