-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlauterbach.js
51 lines (51 loc) · 2.26 KB
/
lauterbach.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require('dotenv').config();
const fs = require("fs");
const { Client, GatewayIntentBits } = require('discord.js');
require("./mod/slashcmds")();
const { joinVoiceChannel, createAudioPlayer, createAudioResource, AudioPlayerStatus } = require('@discordjs/voice');
const client = new Client({ intents: [GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.Guilds] });
client.on('interactionCreate', async interaction => {
if(interaction.commandName === "johnxina"){
if (!interaction.member.voice.channel) {
interaction.reply("join a voice channel to use this command")
}else{
const resource = createAudioResource('./johnxina.ogg');
const lyrics = fs.readFileSync("./bingchilling.txt").toString();
interaction.reply(lyrics)
const connection = joinVoiceChannel({
channelId: interaction.member.voice.channel.id,
guildId: interaction.member.voice.channel.guild.id,
adapterCreator: interaction.member.voice.channel.guild.voiceAdapterCreator,
});
const player = createAudioPlayer();
const sub = connection.subscribe(player);
player.play(resource);
player.on(AudioPlayerStatus.Idle, () => {
sub.unsubscribe();
connection.destroy();
interaction.editReply("https://i.scdn.co/image/ab6761610000e5eb5ade2bbfc5fb33914d5ed14f");
});
}
}
if(interaction.commandName === "bingchilling"){
if (!interaction.member.voice.channel) {
interaction.reply("join a voice channel to use this command")
}else{
const bingchilling = createAudioResource('./bingchilling.ogg');
const connection = joinVoiceChannel({
channelId: interaction.member.voice.channel.id,
guildId: interaction.member.voice.channel.guild.id,
adapterCreator: interaction.member.voice.channel.guild.voiceAdapterCreator,
});
const player = createAudioPlayer();
const sub = connection.subscribe(player);
player.play(bingchilling);
interaction.reply("https://i.scdn.co/image/ab6761610000e5eb5ade2bbfc5fb33914d5ed14f");
player.on(AudioPlayerStatus.Idle, () => {
sub.unsubscribe();
connection.destroy();
});
}
}
})
client.login(process.env.token);