added rzeczy
This commit is contained in:
@@ -7,8 +7,18 @@ import {
|
||||
joinVoiceChannel,
|
||||
type AudioPlayer,
|
||||
} from '@discordjs/voice';
|
||||
import type { VoiceBasedChannel } from 'discord.js';
|
||||
import type { CacheType, ChatInputCommandInteraction, VoiceBasedChannel } from 'discord.js';
|
||||
import { createDiscordJSAdapter } from './adapter.js';
|
||||
import { player } from '../main.js';
|
||||
|
||||
export async function connectToChannelByInteraction(interaction: ChatInputCommandInteraction<CacheType>): Promise<void> {
|
||||
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")
|
||||
const connection = await connectToChannel(voiceChannel);
|
||||
connection.subscribe(player);
|
||||
}
|
||||
|
||||
export async function connectToChannel(channel: VoiceBasedChannel) {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user