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

@@ -2,12 +2,19 @@
import { Client, Events, GatewayIntentBits, MessageFlags, REST, Routes } from 'discord.js';
import dotenv from 'dotenv';
import { commands } from "./commands";
import { createAudioPlayer } from '@discordjs/voice';
import { AudioPlayerState, createAudioPlayer } from '@discordjs/voice';
import { connectToChannel, playSong } from './util/helpers';
import { updatePlayer } from './playback';
dotenv.config()
export const DATA_DIR = "./data";
// AUDIO
export const player = createAudioPlayer();
player.on('stateChange', (oldState: AudioPlayerState, newState: AudioPlayerState) => {
updatePlayer()
});
// Create a new client instance
const client = new Client({
@@ -29,11 +36,17 @@ async function registerCommands() {
const rest = new REST().setToken(process.env.DISCORD_TOKEN!);
const registry = Object.values(commands).map((cmd) => cmd.register().toJSON())
console.log(registry)
const data = await rest.put(Routes.applicationCommands(
await rest.put(Routes.applicationGuildCommands(
process.env.DISCORD_APP_ID!,
process.env.GUILD_ID!
), {
body: registry
});
// await rest.put(Routes.applicationCommands(
// process.env.DISCORD_APP_ID!,
// ), {
// body: registry
// });
}