V11
This commit is contained in:
parent
eb07bb3e67
commit
c1675839da
13
bot/bot.log
13
bot/bot.log
@ -812,3 +812,16 @@ DisTubeError [INVALID_KEY]: 'searchSongs' does not need to be provided in DisTub
|
||||
[2026-02-16T09:12:52.842Z] Ready! Logged in as AsepXiaoQin#6954
|
||||
[2026-02-16T09:12:52.845Z] FFMPEG Path: /home/ubuntu/executor/workspace/bot/node_modules/ffmpeg-static/ffmpeg
|
||||
[2026-02-16T09:12:53.302Z] Alarm scheduled at 30 3 * * *
|
||||
[2026-02-16T09:47:09.105Z] Validation for "rindu aku rindu Kamu": search
|
||||
[2026-02-16T09:47:09.106Z] Searching via play-dl for: rindu aku rindu Kamu
|
||||
[2026-02-16T09:47:09.551Z] Playing: https://www.youtube.com/watch?v=l6jxy4U4GN0
|
||||
[2026-02-16T09:47:10.617Z] Play Error: This url is not supported
|
||||
[2026-02-16T09:47:20.346Z] Validation for "https://open.spotify.com/track/3qhlB30KknSejmIvZZLjOD?si=2NMmRTKnQJ-fMh9OmWm9Bw": sp_track
|
||||
[2026-02-16T09:47:20.349Z] Info fetch error: This is not a YouTube Watch URL
|
||||
[2026-02-16T09:47:20.349Z] Playing: https://open.spotify.com/track/3qhlB30KknSejmIvZZLjOD?si=2NMmRTKnQJ-fMh9OmWm9Bw
|
||||
[2026-02-16T09:48:30.661Z] Playing local file independently: /home/ubuntu/executor/workspace/bot/assets/audio/sahur.mp3
|
||||
[2026-02-16T09:51:23.713Z] Encryption library (libsodium) is ready.
|
||||
[2026-02-16T09:51:25.185Z] Bot berhasil login!
|
||||
[2026-02-16T09:51:25.186Z] Ready! Logged in as AsepXiaoQin#6954
|
||||
[2026-02-16T09:51:25.186Z] FFMPEG Path: /home/ubuntu/executor/workspace/bot/node_modules/ffmpeg-static/ffmpeg
|
||||
[2026-02-16T09:51:26.198Z] Alarm scheduled at 30 3 * * *
|
||||
|
||||
76
bot/index.js
76
bot/index.js
@ -1,6 +1,6 @@
|
||||
process.env.FFMPEG_PATH = require('ffmpeg-static');
|
||||
const ffmpeg = require('ffmpeg-static');
|
||||
const path = require('path');
|
||||
process.env.FFMPEG_PATH = ffmpeg;
|
||||
if (ffmpeg) {
|
||||
const ffmpegDir = path.dirname(ffmpeg);
|
||||
if (!process.env.PATH.includes(ffmpegDir)) {
|
||||
@ -11,6 +11,7 @@ const { Client, GatewayIntentBits, Events, EmbedBuilder, PermissionsBitField } =
|
||||
const { DisTube } = require('distube');
|
||||
const { SoundCloudPlugin } = require('@distube/soundcloud');
|
||||
const { SpotifyPlugin } = require('@distube/spotify');
|
||||
const { YtDlpPlugin } = require('@distube/yt-dlp');
|
||||
const play = require('play-dl');
|
||||
const {
|
||||
joinVoiceChannel,
|
||||
@ -45,13 +46,12 @@ try {
|
||||
logToFile("Warning: libsodium-wrappers not found or failed to load.");
|
||||
}
|
||||
|
||||
const distube = new DisTube(client, {
|
||||
emitNewSongOnly: true,
|
||||
const distube = new DisTube(client, {
|
||||
plugins: [
|
||||
new SoundCloudPlugin(),
|
||||
new SpotifyPlugin(),
|
||||
],
|
||||
emitAddSongWhenCreatingQueue: false,
|
||||
new SpotifyPlugin(),
|
||||
new SoundCloudPlugin(),
|
||||
new YtDlpPlugin({ update: true })
|
||||
]
|
||||
});
|
||||
|
||||
const VC_ID = process.env.VC_ID;
|
||||
@ -180,41 +180,11 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||
if (!voiceChannel) return interaction.editReply({ content: 'Anda harus berada di voice channel!' });
|
||||
|
||||
try {
|
||||
let url = query;
|
||||
let title = query;
|
||||
const validation = await play.validate(query);
|
||||
|
||||
logToFile(`Validation for "${query}": ${validation}`);
|
||||
|
||||
if (!validation || validation === 'search') {
|
||||
logToFile(`Searching via play-dl for: ${query}`);
|
||||
const searchResults = await play.search(query, { limit: 1 });
|
||||
|
||||
if (!searchResults || searchResults.length === 0) {
|
||||
return interaction.editReply('Lagu tidak ditemukan!');
|
||||
}
|
||||
|
||||
url = searchResults[0].url;
|
||||
title = searchResults[0].title;
|
||||
} else {
|
||||
// It's a URL, attempt to get title
|
||||
try {
|
||||
const info = await play.video_info(url);
|
||||
title = info.video_details.title;
|
||||
url = info.video_details.url;
|
||||
} catch (err) {
|
||||
logToFile(`Info fetch error: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
logToFile(`Playing: ${url}`);
|
||||
await distube.play(voiceChannel, url, {
|
||||
member: interaction.member,
|
||||
textChannel: interaction.channel,
|
||||
metadata: { interaction, songTitle: title }
|
||||
await distube.play(voiceChannel, query, {
|
||||
textChannel: interaction.channel,
|
||||
member: interaction.member
|
||||
});
|
||||
|
||||
await interaction.editReply(`Memainkan: **${title}**... 🎶`);
|
||||
await interaction.editReply(`Mencari dan memutar: **${query}**... 🎶`);
|
||||
} catch (e) {
|
||||
logToFile(`Play Error: ${e.message}`);
|
||||
if (interaction.deferred) {
|
||||
@ -267,32 +237,12 @@ client.on(Events.MessageCreate, async message => {
|
||||
if (!query) return message.reply('Masukkan judul atau link lagu!');
|
||||
|
||||
try {
|
||||
let url = query;
|
||||
let title = query;
|
||||
const validation = await play.validate(query);
|
||||
|
||||
if (!validation || validation === 'search') {
|
||||
const searchResults = await play.search(query, { limit: 1 });
|
||||
if (!searchResults || searchResults.length === 0) return message.reply('Lagu tidak ditemukan!');
|
||||
url = searchResults[0].url;
|
||||
title = searchResults[0].title;
|
||||
} else {
|
||||
try {
|
||||
const info = await play.video_info(url);
|
||||
title = info.video_details.title;
|
||||
url = info.video_details.url;
|
||||
} catch (err) {
|
||||
logToFile(`Prefix info fetch error: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
message.reply(`🔍 Memainkan: **${title}**...`);
|
||||
|
||||
await distube.play(voiceChannel, url, {
|
||||
await distube.play(voiceChannel, query, {
|
||||
member: message.member,
|
||||
textChannel: message.channel,
|
||||
message
|
||||
});
|
||||
message.reply(`🔍 Mencari dan memutar: **${query}**...`);
|
||||
} catch (e) {
|
||||
logToFile(`Message Play Error: ${e.message}`);
|
||||
message.reply(`❌ Error: ${e.message}`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user