V5
This commit is contained in:
parent
ad181c4cc0
commit
6327e98567
@ -2,6 +2,6 @@
|
||||
"discord_token": "MTQ3MTkwOTE5Mzg4Njg1OTI5NA.GCEdpc.jMIxPFsquVAhp88x3dO-yWUFI7e1u1r8oIZTcw",
|
||||
"guild_id": "1428530728706117632",
|
||||
"voice_channel_id": "1457687430189682781",
|
||||
"alarm_time": "09:05",
|
||||
"alarm_time": "09:17",
|
||||
"last_voice_channel": null
|
||||
}
|
||||
22
index.js
22
index.js
@ -1,6 +1,7 @@
|
||||
process.env.FFMPEG_PATH = require('ffmpeg-static');
|
||||
const { Client, GatewayIntentBits, SlashCommandBuilder, Routes } = require('discord.js');
|
||||
const { joinVoiceChannel, createAudioPlayer, createAudioResource, getVoiceConnection, VoiceConnectionStatus } = require('@discordjs/voice');
|
||||
const ffmpeg = require('ffmpeg-static');
|
||||
process.env.FFMPEG_PATH = ffmpeg;
|
||||
const { Client, GatewayIntentBits, SlashCommandBuilder, Routes, ActivityType } = require('discord.js');
|
||||
const { joinVoiceChannel, createAudioPlayer, createAudioResource, getVoiceConnection, VoiceConnectionStatus, StreamType } = require('@discordjs/voice');
|
||||
const { REST } = require('@discordjs/rest');
|
||||
const { join } = require('path');
|
||||
const fs = require('fs');
|
||||
@ -15,9 +16,19 @@ const client = new Client({
|
||||
|
||||
const player = createAudioPlayer();
|
||||
|
||||
player.on('error', error => {
|
||||
console.error('Error Audio:', error);
|
||||
});
|
||||
|
||||
client.on('ready', async () => {
|
||||
console.log(`Bot logged in as ${client.user.tag}`);
|
||||
|
||||
// Set Status Online dan Aktivitas
|
||||
client.user.setPresence({
|
||||
activities: [{ name: 'Lilis', type: ActivityType.Watching }],
|
||||
status: 'online',
|
||||
});
|
||||
|
||||
// Register Commands
|
||||
const commands = [
|
||||
new SlashCommandBuilder().setName('join').setDescription('Bot masuk ke Voice Channel'),
|
||||
@ -77,7 +88,10 @@ client.on('interactionCreate', async interaction => {
|
||||
|
||||
try {
|
||||
// Audio Fix as requested with Volume Booster
|
||||
const resource = createAudioResource(join(__dirname, 'assets', 'audio', 'sahur.mp3'), { inlineVolume: true });
|
||||
const resource = createAudioResource(join(__dirname, 'assets', 'audio', 'sahur.mp3'), {
|
||||
inputType: StreamType.Arbitrary,
|
||||
inlineVolume: true
|
||||
});
|
||||
resource.volume.setVolume(1.0);
|
||||
|
||||
connection.subscribe(player);
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@ -10,7 +10,7 @@
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.17.0",
|
||||
"discord.js": "^14.15.3",
|
||||
"ffmpeg-static": "^5.2.0",
|
||||
"ffmpeg-static": "^5.3.0",
|
||||
"libsodium-wrappers": "^0.7.16",
|
||||
"opusscript": "^0.0.8"
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.17.0",
|
||||
"discord.js": "^14.15.3",
|
||||
"ffmpeg-static": "^5.2.0",
|
||||
"ffmpeg-static": "^5.3.0",
|
||||
"libsodium-wrappers": "^0.7.16",
|
||||
"opusscript": "^0.0.8"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user