diff --git a/data/config.json b/data/config.json index fd66921..349182d 100644 --- a/data/config.json +++ b/data/config.json @@ -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 } \ No newline at end of file diff --git a/index.js b/index.js index 3a2a826..d758d97 100644 --- a/index.js +++ b/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); diff --git a/package-lock.json b/package-lock.json index e6c59a8..9ff6768 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" } diff --git a/package.json b/package.json index 4ea91d3..1c27733 100644 --- a/package.json +++ b/package.json @@ -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" }