mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-02-01 07:04:11 +05:00
resolve issues
This commit is contained in:
commit
0ea85ec3ac
3 changed files with 1 additions and 94 deletions
|
@ -57,7 +57,7 @@ If you want to contribute, feel free to fork this repo and making a pull request
|
|||
## TODO
|
||||
|
||||
* [ ] Refactor [tictactoe](./helpers/tictactoe.js).
|
||||
* [ ] Rewrite dashboard.
|
||||
* [ ] Finish and release *dashboard-core* submodule.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
const { SlashCommandBuilder, PermissionsBitField, InteractionContextType, ApplicationIntegrationType } = require("discord.js"),
|
||||
{ QueryType } = require("discord-player");
|
||||
const BaseCommand = require("../../base/BaseCommand"),
|
||||
fs = require("fs");
|
||||
|
||||
class Clips extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/Client")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("clips")
|
||||
.setDescription(client.translate("music/clips:DESCRIPTION"))
|
||||
.setDescriptionLocalizations({
|
||||
uk: client.translate("music/clips:DESCRIPTION", null, "uk-UA"),
|
||||
ru: client.translate("music/clips:DESCRIPTION", null, "ru-RU"),
|
||||
})
|
||||
.setIntegrationTypes([ApplicationIntegrationType.GuildInstall])
|
||||
.setContexts([InteractionContextType.Guild])
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName("query")
|
||||
.setDescription(client.translate("music/clips:QUERY"))
|
||||
.setDescriptionLocalizations({
|
||||
uk: client.translate("music/clips:QUERY", null, "uk-UA"),
|
||||
ru: client.translate("music/clips:QUERY", null, "ru-RU"),
|
||||
})
|
||||
.setRequired(true)
|
||||
.setAutocomplete(true),
|
||||
),
|
||||
dirname: __dirname,
|
||||
ownerOnly: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/Client")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
await interaction.deferReply();
|
||||
|
||||
const query = interaction.options.getString("query"),
|
||||
voice = interaction.member.voice.channel;
|
||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true });
|
||||
|
||||
const perms = voice.permissionsFor(client.user);
|
||||
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT", null, { edit: true });
|
||||
|
||||
client.player.play(interaction.member.voice.channel, query, {
|
||||
nodeOptions: {
|
||||
metadata: interaction,
|
||||
},
|
||||
searchEngine: QueryType.FILE,
|
||||
selfDeaf: true,
|
||||
leaveOnEnd: false,
|
||||
leaveOnStop: true,
|
||||
skipOnNoStream: true,
|
||||
bufferingTimeout: 1000,
|
||||
});
|
||||
|
||||
interaction.editReply({
|
||||
content: interaction.translate("music/play:ADDED_QUEUE", {
|
||||
songName: query.substring(8, query.length - 4),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/Client")} client
|
||||
* @param {import("discord.js").AutocompleteInteraction} interaction
|
||||
* @returns
|
||||
*/
|
||||
async autocompleteRun(client, interaction) {
|
||||
const query = interaction.options.getString("query"),
|
||||
files = fs.readdirSync("./clips"),
|
||||
results = files.filter(f => f.includes(query));
|
||||
|
||||
return await interaction.respond(
|
||||
results.slice(0, 25).map(file => ({
|
||||
name: file.substring(0, file.length - 4),
|
||||
value: `./clips/${file}`,
|
||||
})),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Clips;
|
|
@ -38,7 +38,6 @@ class Ready extends BaseEvent {
|
|||
`I'm in ${servers} ${client.functions.getNoun(servers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}!`,
|
||||
`Cached ${users} ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}.`,
|
||||
"Use /help for commands list!",
|
||||
"Did you know that I have a brother called JaBa IT? Yeah! Ask Jonny about him.",
|
||||
];
|
||||
|
||||
let i = 0;
|
||||
|
|
Loading…
Reference in a new issue