added rzeczy

This commit is contained in:
Patryk Koreń
2025-12-26 20:45:38 +01:00
parent 375779de9c
commit b551cce62a
14 changed files with 326 additions and 91 deletions

View File

@@ -1,7 +1,7 @@
import { CacheType, ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
import { connectToChannel, playSong } from '../util/helpers';
import { player } from '../main';
import { get_audio } from '../util/downloader';
import { connectToChannelByInteraction } from '../util/helpers';
import { requestSong } from '../playback';
import { getPlayMsg } from '../messages';
const name = "play"
@@ -16,27 +16,14 @@ function register() {
async function execute(interaction: ChatInputCommandInteraction<CacheType>) {
try {
// await interaction.reply(`${interaction}`);
const member = await interaction.guild?.members.fetch(interaction.user.id);
if (!member) throw new Error("ale chuj")
const voiceChannel = member.voice.channel;
if (!voiceChannel) throw new Error("ale chuj 2")
connectToChannelByInteraction(interaction)
const connection = await connectToChannel(voiceChannel);
connection.subscribe(player);
await interaction.reply('https://gitea.papryk.com/Papryk/dj-spangebob pull requesty milewidziane XD');
const url = interaction.options.getString("url")!;
const path = await get_audio(url)
// const path = "/home/patryk/Papryk/dbot/data/Kino - Summer is ending Кино - Кончится лето [6VqiMQoMXmw].opus"
console.log(path)
await playSong(player, path);
await requestSong(interaction, url)
const msg = getPlayMsg(url)
await interaction.reply(msg);
} catch (error) {
/**
* The song isn't ready to play for some reason :(
*/
console.error(error);
await interaction.reply('Coś poszło nie tak :/');
}