⭐🚀 TkyNET | Blacklist ve Profesyonel DDoS Korumalı TeamSpeak 3 Sunucuları 🚀⭐
Sponsor Görsel
⭐Kurumsal web sitesi barındırma, VDS ve sanal sunucu çözümleri. Name SSD altyapısı, yüksek performans, kesintisiz erişim ve profesyonel teknik destekle hizmetinizde.⭐
Sponsor Görsel 2
SponsorSponsor

Di̇scord Müzi̇k Botu

Konu

#1
JAVA SCRİPT İLE TASARLADIĞIM BASİT DİSCORD MÜZİK BOTU 
Kod:
const { Client, GatewayIntentBits } = require("discord.js");
const { joinVoiceChannel, createAudioPlayer, createAudioResource, AudioPlayerStatus } = require("@discordjs/voice");
const ytdl = require("ytdl-core");

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildVoiceStates,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent
  ]
});

const prefix = "!";
const player = createAudioPlayer();

client.once("ready", () => {
  console.log(`✅ ${client.user.tag} müzik botu aktif`);
});

client.on("messageCreate", async (message) => {
  if (!message.content.startsWith(prefix) || message.author.bot) return;

  const args = message.content.slice(prefix.length).trim().split(/ +/);
  const command = args.shift().toLowerCase();

  if (command === "play") {
    if (!args[0]) return message.reply(" Bir YouTube linki girin");
    if (!message.member.voice.channel) return message.reply("Önce ses kanalına girin");

    const connection = joinVoiceChannel({
      channelId: message.member.voice.channel.id,
      guildId: message.guild.id,
      adapterCreator: message.guild.voiceAdapterCreator,
    });

    const stream = ytdl(args[0], { filter: "audioonly" });
    const resource = createAudioResource(stream);

    player.play(resource);
    connection.subscribe(player);

    message.reply("Müzik çalıyor!");
  }

  if (command === "stop") {
    player.stop();
    message.reply("Müzik durduruldu.");
  }
});

player.on(AudioPlayerStatus.Idle, () => {
  console.log("Müzik bitti.");
});

client.login("BOT_TOKEN_BURAYA");

LOGO TASARIMI BANNER TASARIMI İÇİN DM
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da