client .on('guildMemberAdd', async member => { var channel = member.guild.channels.cache.get('776889309490970646') var embed = new Discord.MessageEmbed() .setAuthor(member.user.username, member.user.avatarURL({ dynamic: true })) .setThumbnail(member.guild.iconURL({ dynamic: true })) .setDescription(`**Sunucumuza Hoşgeldin ** <@${member.user.id}>`) .addFields({ name: `Kayıt Olmak İçin : `, value: `?kayıt Yazabilirsin` }, { name: `Kayıt İşlemini Tamamlamak İçin : `, value: `Sana Özel Oluşturulan Ses Kanalına Girebilirsin` }, { name: `Botumuz Sana Gerekli Bilgileri Verdikten Sonra Kanaldan Çıkabilirsin`, value: `İyi Eğlenceler <3` }) member.send(embed) channel.send(embed) }) .on('guildMemberRemove', async member => { var channelId = db.get(`${member.user.id}_regch.channelid`) var dataid = db.get(`${member.user.id}_regch.member`) if (dataid && channelId) { var channel = member.guild.channels.cache.get(channelId) channel.delete() } }) .on('voiceStateUpdate', async(oldMember, newS) => { console.log(oldMember.id) var data = db.get(`${oldMember.id}_regch.channelid`) var dataid = db.get(`${oldMember.id}_regch.member`) if (oldMember.channelID == data && oldMember.id == dataid) { if (dataid != oldMember.id) return; if (dataid == oldMember.id) { var channel = client.channels.cache.get(data) channel.delete(); var member = newS.guild.members.cache.get(dataid) member.roles.add('776854134955442226') db.delete(`${oldMember.id}_regch`) var chn = oldMember.guild.channels.cache.get('791452464536748032') chn.send(`${member.user.username}, Aramıza Katıldı Herkes Ona Merhaba Desin !!`) } }; }) .on("voiceStateUpdate", async(oldMember, newMember) => { var channelId = db.get(`${oldMember.id}_regch.channelid`) var dataid = db.get(`${oldMember.id}_regch.member`) if (newMember.channelID == channelId && newMember.id == dataid && newMember.id !== client.user.id) { let member = newMember.guild.members.cache.get(newMember.id) let isim = member.user.username const url = googleTTS.getAudioUrl(`merhaba ${isim} devrimsofta hoş geldin kuralları okumayı unutma kanaldan çıkınca yetkini vereceğim`, { lang: 'tr-TR', slow: false, host: 'https://translate.google.com', }); console.log(url); const broadcast = client.voice.createBroadcast(); var channel = client.channels.cache.get(channelId); channel.join().then(async connection => { broadcast.play(url); const dispatcher = await connection.play(broadcast); dispatcher.on('end', () => { channel.disconnect(); }) }); }; }) .on("message", async message => { if (message.author.bot) return; if (!message.guild) return; let prefix = await db.get(`prefix_${message.guild.id}`) if (prefix === null) prefix = config.prefix; const args = message.content.slice(prefix.length).trim().split(/ +/g); const command = args.shift(); if (message.content.startsWith(prefix)) { let random = getRandomInt(8); message.react(emojis); } else { return; } try { if (command === "kayıt") { try { var member = message.guild.members.cache.get(message.author.id) var data = db.get(`${member.user.id}_regch`) if (data) return message.reply('Zaten Bir kanalın bulunmakta') var channelId = db.get(`${member.user.id}_regch.channelid`) if (message.channel.id == "776889309490970646") { if (args[0]) { //message.author.roles.add('776854134955442226') member.setNickname(`• ${args[0]}`) var guildid = message.guild.id var guild = client.guilds.cache.get(guildid) guild.channels.create(`${member.user.username} • Kayıt `, { type: 'voice', reason: 'New channel added for fun!' }).then(r => { let category = guild.channels.cache.find(c => c.id == "782617316667031552" && c.type == "category"); r.setParent(category.id); r.overwritePermissions([{ id: guild.id, deny: ['VIEW_CHANNEL'], }, { id: member.user.id, allow: ['VIEW_CHANNEL'], }, ]); db.set(`${member.user.id}_regch`, { channelid: `${r.id}`, member: `${member.user.id}` }) message.reply(`***<#${r.id}>* Ses Kanalına Giriş Yaparsan Botumuz Sana Gerekli Bilgileri Verecektir , Botumuz Sana Gerekli Bilgileri Verdikten Sonra Kanaldan Çıkabilirsin !!**`) }) } else { message.reply('Bir İsim Belirtmelisin').then(msg => msg.delete({ timeout: 5000 }).catch(console.error)); } } else { return message.reply('Bu Komudu Sadece kayıt kanalında kullanbilirisin'); } } catch (error) { console.log(error) } } } catch (error) { console.error } })