added rzeczy
This commit is contained in:
17
src/main.ts
17
src/main.ts
@@ -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
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user