mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
v4.1.3
This commit is contained in:
parent
0046828464
commit
1c974302ae
13 changed files with 927 additions and 872 deletions
|
@ -7,7 +7,6 @@ const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } = r
|
|||
|
||||
const BaseEvent = require("./BaseEvent.js"),
|
||||
BaseCommand = require("./BaseCommand.js"),
|
||||
// AmeClient = require("amethyste-api"),
|
||||
path = require("path"),
|
||||
fs = require("fs").promises,
|
||||
mongoose = require("mongoose"),
|
||||
|
@ -44,10 +43,8 @@ class JaBa extends Client {
|
|||
this.databaseCache.users = new Collection();
|
||||
this.databaseCache.guilds = new Collection();
|
||||
this.databaseCache.members = new Collection();
|
||||
this.databaseCache.usersReminds = new Collection(); // members with active reminds
|
||||
this.databaseCache.mutedUsers = new Collection(); // members who are currently muted
|
||||
|
||||
// if (this.config.apiKeys.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste);
|
||||
this.databaseCache.usersReminds = new Collection();
|
||||
this.databaseCache.mutedUsers = new Collection();
|
||||
|
||||
this.discordTogether = new DiscordTogether(this);
|
||||
|
||||
|
|
|
@ -10,7 +10,9 @@ class Transactions extends BaseCommand {
|
|||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("transactions")
|
||||
.setDescription(client.translate("economy/transactions:DESCRIPTION")),
|
||||
.setDescription(client.translate("economy/transactions:DESCRIPTION"))
|
||||
.addBooleanOption(option => option.setName("clear")
|
||||
.setDescription(client.translate("economy/translactions:CLEAR"))),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
guildOnly: true,
|
||||
|
@ -31,6 +33,13 @@ class Transactions extends BaseCommand {
|
|||
* @param {Object} data
|
||||
*/
|
||||
async execute(client, interaction, data) {
|
||||
if (interaction.options.getBoolean("clear")) {
|
||||
data.memberData.transactions = [];
|
||||
await data.memberData.save();
|
||||
|
||||
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"),
|
||||
|
|
|
@ -35,22 +35,26 @@ class Play extends BaseCommand {
|
|||
*/
|
||||
async execute(client, interaction) {
|
||||
await interaction.deferReply();
|
||||
|
||||
const voice = interaction.member.voice.channel;
|
||||
if (!voice) return interaction.editReply({ content: interaction.translate("music/play:NO_VOICE_CHANNEL") });
|
||||
const query = interaction.options.getString("query");
|
||||
const perms = voice.permissionsFor(client.user);
|
||||
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.editReply({ content: interaction.translate("music/play:VOICE_CHANNEL_CONNECT") });
|
||||
|
||||
const searchResult = await client.player.search(query, {
|
||||
try {
|
||||
var searchResult = await client.player.search(query, {
|
||||
requestedBy: interaction.user,
|
||||
searchEngine: "jaba"
|
||||
}).catch(() => {});
|
||||
|
||||
if (!searchResult || !searchResult.tracks.length) return interaction.editReply({
|
||||
});
|
||||
} catch (error) {
|
||||
return interaction.editReply({
|
||||
content: interaction.translate("music/play:NO_RESULT", {
|
||||
query
|
||||
query,
|
||||
error
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
const queue = client.player.getQueue(interaction.guildId) || client.player.createQueue(interaction.guild, {
|
||||
metadata: { channel: interaction.channel },
|
||||
|
@ -123,7 +127,6 @@ class Play extends BaseCommand {
|
|||
.setTitle(interaction.translate("music/play:RESULTS_TITLE", {
|
||||
query
|
||||
}))
|
||||
.setThumbnail(interaction.client.user.avatarURL())
|
||||
.setColor(client.config.embed.color)
|
||||
.setDescription(searchResult.tracks.map(track => {
|
||||
const views = new Intl.NumberFormat(interaction.client.languages.find(language => language.name === interaction.guild.data.language).moment, {
|
||||
|
@ -155,24 +158,19 @@ class Play extends BaseCommand {
|
|||
if (!queue.connection) await queue.connect(interaction.member.voice.channel);
|
||||
if (!queue.playing) await queue.play();
|
||||
|
||||
rows.forEach(row => {
|
||||
row.components.forEach(component => {
|
||||
component.setDisabled(true);
|
||||
});
|
||||
});
|
||||
|
||||
return interaction.editReply({
|
||||
content: interaction.translate("music/play:ADDED_QUEUE", {
|
||||
songName: selected.title
|
||||
}),
|
||||
components: [row1, row2, row3]
|
||||
components: [],
|
||||
embeds: []
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
client.player.deleteQueue(interaction.guildId);
|
||||
console.error(e);
|
||||
console.log(error);
|
||||
return interaction.editReply({
|
||||
content: interaction.translate("music/play:ERR_OCCURRED", {
|
||||
error: e
|
||||
error
|
||||
})
|
||||
});
|
||||
}
|
||||
|
@ -220,12 +218,12 @@ class Play extends BaseCommand {
|
|||
songName: searchResult.playlist ? searchResult.playlist.title : searchResult.tracks[0].title
|
||||
})
|
||||
});
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
client.player.deleteQueue(interaction.guildId);
|
||||
console.error(e);
|
||||
console.log(error);
|
||||
return interaction.editReply({
|
||||
content: interaction.translate("music/play:ERR_OCCURRED", {
|
||||
error: e
|
||||
error
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ module.exports = {
|
|||
name: "XXXXXXXXXXX#1234" // And the name of the bot's owner
|
||||
},
|
||||
/* The API keys that are required for certain commands */
|
||||
apiKeys: {
|
||||
// AMETHYSTE: https://api.amethyste.moe
|
||||
amethyste: "XXXXXXXXXXX"
|
||||
}
|
||||
/* Not used right now */
|
||||
apiKeys: {}
|
||||
};
|
|
@ -1,3 +1,11 @@
|
|||
### JaBa v4.1.3
|
||||
* Добавлено
|
||||
* Возможность принудительной очистки транзакций с помощью *transactions clear:True*
|
||||
|
||||
* Изменения
|
||||
* Сделал перепись населения буквам в коде, теперь их меньше.
|
||||
* Переделал обработку ошибок в *play*, теперь она говорит ошибку, а не считает её неизвестной.
|
||||
|
||||
### JaBa v4.1.2
|
||||
* Добавлено
|
||||
* Выбор при поиске текстом через команду *play*.
|
||||
|
|
|
@ -88,9 +88,8 @@ class DiscordTogether {
|
|||
/**
|
||||
* @param {String} code The invite link (only use the blue link)
|
||||
*/
|
||||
const returnData = {
|
||||
code: "none",
|
||||
};
|
||||
const returnData = { code: "none" };
|
||||
|
||||
if (option && this.applications.find(apps => apps.id === option).id) {
|
||||
const applicationID = this.applications.find(apps => apps.id === option).id;
|
||||
try {
|
||||
|
@ -107,8 +106,8 @@ class DiscordTogether {
|
|||
Authorization: `Bot ${this.client.config.token}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}).then((res) => res.json())
|
||||
.then((invite) => {
|
||||
}).then(res => res.json())
|
||||
.then(invite => {
|
||||
if (invite.error || !invite.code) throw new Error("An error occured while retrieving data!");
|
||||
if (Number(invite.code) === 50013) console.warn("Your bot lacks permissions to perform that action");
|
||||
returnData.code = `https://discord.com/invite/${invite.code}`;
|
||||
|
@ -123,7 +122,4 @@ class DiscordTogether {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
DiscordTogether,
|
||||
defaultApplications
|
||||
};
|
||||
module.exports = { DiscordTogether, defaultApplications };
|
|
@ -267,7 +267,7 @@ module.exports = {
|
|||
return resolve({ playlist: null, info: null });
|
||||
} catch (error) {
|
||||
console.log(`Extractor: An error occurred while attempting to resolve ${query} :\n${error}`);
|
||||
return resolve({ playlist: null, info: null });
|
||||
return reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const i18next = require("i18next"),
|
||||
Backend = require("i18next-node-fs-backend"),
|
||||
Backend = require("i18next-fs-backend"),
|
||||
path = require("path"),
|
||||
fs = require("fs").promises;
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
"DESCRIPTION": "Посмотреть историю транзакций",
|
||||
"USAGE": "",
|
||||
"EXAMPLES": "transactions",
|
||||
"NO_TRANSACTIONS": "У вас нет транзакций.",
|
||||
"CLEAR": "Очистить список транзакций?",
|
||||
"CLEARED": "Список транзакций очищен",
|
||||
"NO_TRANSACTIONS": "У вас нет транзакций",
|
||||
"EMBED_TRANSACTIONS": "Ваши транзакции",
|
||||
"BANK": "Банк",
|
||||
"NUMBERS": "Угадай число",
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
"VOICE_CHANNEL_CONNECT": "Я не могу присоедениться к вашему голосовому каналу!",
|
||||
"SEARCH_RESULTS": "Я нашёл данные видео на просторах Youtube'а! Выберите что-то одно с помощью кнопок ниже.",
|
||||
"RESULTS_TITLE": "Результаты поиска по \"{{query}}\"",
|
||||
"NO_RESULT": "Произошла неизвестная ошибка при поиске `{{query}}`! Скорее всего это видео имеет ограничение по возрасту.",
|
||||
"NO_RESULT": "Произошла ошибка при поиске `{{query}}`!\n```{{error}}```",
|
||||
"NOW_PLAYING": "Сейчас играет **{{songName}}**",
|
||||
"NOT_PLAYING": "На сервере сейчас ничего не воспроизводится",
|
||||
"QUEUE_ENDED": "Очередь окончена",
|
||||
"ADDED_QUEUE": "**{{songName}}** добавлен в очередь",
|
||||
"STOP_DISCONNECTED": "Воспроизведение окончено, т.к. я вышел из голосового канала.",
|
||||
"STOP_EMPTY": "Воспроизведение окончено, т.к. все вышли из голосового канала.",
|
||||
"ERR_OCCURRED": "Произошла ошибка...\n`{{error}}`"
|
||||
"ERR_OCCURRED": "Произошла ошибка...\n```{{error}}```"
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
"VOICE_CHANNEL_CONNECT": "Я не можу приєднатися до вашого голосового каналу!",
|
||||
"MISSING_SONG_NAME": "Вкажіть назву треку або посилання на нього!",
|
||||
"RESULTS_FOOTER": "Вкажіть число від 1 до 10 (без префіксу).",
|
||||
"NO_RESULT": "Нічого не знайдено!",
|
||||
"NO_RESULT": "Нічого не знайдено!\n```{{error}}```",
|
||||
"NOW_PLAYING": "Зараз грає **{{songName}}**",
|
||||
"PLAYING_PLAYLIST": "Починається відтворення плейлиста **{{playlistTitle}}**. {{playlistEmoji}}\nПочато відтворення першого треку, **{{songName}}**!",
|
||||
"CANCELLED": "Вибір скасовано",
|
||||
|
|
1672
package-lock.json
generated
1672
package-lock.json
generated
File diff suppressed because it is too large
Load diff
19
package.json
19
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jaba",
|
||||
"version": "4.1.2",
|
||||
"version": "4.1.3",
|
||||
"description": "My Discord Bot",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
@ -16,12 +16,11 @@
|
|||
"@discordjs/opus": "^0.8.0",
|
||||
"@discordjs/rest": "^1.1.0",
|
||||
"@discordjs/voice": "^0.11.0",
|
||||
"amethyste-api": "github:Androz2091/amethyste-api",
|
||||
"btoa": "^1.2.1",
|
||||
"canvacord": "^5.1.0",
|
||||
"canvas": "^2.9.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cron": "^1.7.2",
|
||||
"chalk": "^4.1.2",
|
||||
"cron": "^2.1.0",
|
||||
"discord-api-types": "^0.37.5",
|
||||
"discord-giveaways": "^6.0.1",
|
||||
"discord-player": "github:JonnyBro/discord-player",
|
||||
|
@ -29,21 +28,21 @@
|
|||
"ejs": "^3.1.3",
|
||||
"express": "^4.17.1",
|
||||
"express-session": "^1.17.0",
|
||||
"ffmpeg-static": "^4.4.1",
|
||||
"ffmpeg-static": "^5.1.0",
|
||||
"gamedig": "^4.0.2",
|
||||
"i18next": "^20.2.2",
|
||||
"i18next-node-fs-backend": "^2.1.3",
|
||||
"i18next": "^21.9.1",
|
||||
"i18next-fs-backend": "^1.1.5",
|
||||
"libsodium-wrappers": "^0.7.10",
|
||||
"markdown-table": "2.0.0",
|
||||
"markdown-table": "^2.0.0",
|
||||
"md5": "^2.2.1",
|
||||
"moment": "^2.26.0",
|
||||
"mongoose": "^5.13.14",
|
||||
"mongoose": "^5.13.15",
|
||||
"ms": "^2.1.3",
|
||||
"play-dl": "^1.9.5",
|
||||
"prism-media": "^1.3.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.5.0"
|
||||
"eslint": "^8.23.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
|
|
Loading…
Reference in a new issue