NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

const Discord = require('discord.js');
const ytdl = require('ytdl-core');
const client = new Discord.Client();
const ayarlar = require('./ayarlar.json');
const { GOOGLE_API_KEY } = require('./ayarlar.json');
const YouTube = require('simple-youtube-api');
const superagent = require("superagent");
const chalk = require('chalk');
const fs = require('fs');
const weather = require('weather-js')
const hastebin = require('hastebin-gen');
const moment = require('moment');
const jsonfile = require('jsonfile')
require('./util/eventLoader')(client);

const youtube = new YouTube(GOOGLE_API_KEY);

const queue = new Map();

var prefix = ayarlar.prefix;

const log = message => {
console.log(`${message}`);
};

client.GetSupportChannel = (member) => {
return new Promise ((resolve,reject) => {
try{
let exists = fs.existsSync('./jsonlar/destek.json')
if (exists) {
obj = jsonfile.readFileSync('./jsonlar/destek.json')
if (!obj[member.guild.id]) resolve(undefined);
else resolve(obj[member.guild.id]);
}
} catch (ex) {
console.error(ex);
reject(ex)
}
})
}

client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
fs.readdir('./komutlar/', (err, files) => {
if (err) console.error(err);
log(`${files.length} komut yüklenecek.`);
files.forEach(f => {
let props = require(`./komutlar/${f}`);
log(`Yüklenen komut: ${props.help.name}.`);
client.commands.set(props.help.name, props);
props.conf.aliases.forEach(alias => {
client.aliases.set(alias, props.help.name);
});
});
});

client.reload = command => {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(`./komutlar/${command}`)];
let cmd = require(`./komutlar/${command}`);
client.commands.delete(command);
client.aliases.forEach((cmd, alias) => {
if (cmd === command) client.aliases.delete(alias);
});
client.commands.set(command, cmd);
cmd.conf.aliases.forEach(alias => {
client.aliases.set(alias, cmd.help.name);
});
resolve();
} catch (e){
reject(e);
}
});
};

client.load = command => {
return new Promise((resolve, reject) => {
try {
let cmd = require(`./komutlar/${command}`);
client.commands.set(command, cmd);
cmd.conf.aliases.forEach(alias => {
client.aliases.set(alias, cmd.help.name);
});
resolve();
} catch (e){
reject(e);
}
});
};

client.reload = command => {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(`./komutlar/${command}`)];
let cmd = require(`./komutlar/${command}`);
client.commands.delete(command);
client.aliases.forEach((cmd, alias) => {
if (cmd === command) client.aliases.delete(alias);
});
client.commands.set(command, cmd);
cmd.conf.aliases.forEach(alias => {
client.aliases.set(alias, cmd.help.name);
});
resolve();
} catch (e){
reject(e);
}
});
};

client.load = command => {
return new Promise((resolve, reject) => {
try {
let cmd = require(`./komutlar/${command}`);
client.commands.set(command, cmd);
cmd.conf.aliases.forEach(alias => {
client.aliases.set(alias, cmd.help.name);
});
resolve();
} catch (e){
reject(e);
}
});
};

client.unload = command => {
return new Promise((resolve, reject) => {
try {
delete require.cache[require.resolve(`./komutlar/${command}`)];
let cmd = require(`./komutlar/${command}`);
client.commands.delete(command);
client.aliases.forEach((cmd, alias) => {
if (cmd === command) client.aliases.delete(alias);
});
resolve();
} catch (e){
reject(e);
}
});
};

client.on('message', async msg => {

if (msg.author.bot) return undefined;
if (!msg.content.startsWith(prefix)) return undefined;

const args = msg.content.split(' ');
const searchString = args.slice(1).join(' ');
const url = args[1] ? args[1].replace(/<(.+)>/g, '$1') : '';
const serverQueue = queue.get(msg.guild.id);

let command = msg.content.toLowerCase().split(' ')[0];
command = command.slice(prefix.length)

if (command === 'çal') {
const voiceChannel = msg.member.voiceChannel;
if (!voiceChannel) return msg.channel.send('** :mute:Müzik Çalmak İçin Bir Sesli Odaya Girmelisin**');
const permissions = voiceChannel.permissionsFor(msg.client.user);
if (!permissions.has('CONNECT')) {
return msg.channel.send('**:mute:O Odaya Girme Yetkim Yok**');
}
if (!permissions.has('SPEAK')) {
return msg.channel.send('**:mute:Bu Odada Konuşma Yetkim Yok**');
}

if (url.match(/^https?://(www.youtube.com|youtube.com)/playlist(.*)$/)) {
const playlist = await youtube.getPlaylist(url);
const videos = await playlist.getVideos();
for (const video of Object.values(videos)) {
const video2 = await youtube.getVideoByID(video.id); // eslint-disable-line no-await-in-loop
await handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
}
return msg.channel.send(`**✅ Oynatma Listesi: **${playlist.title}** Kuyruğa Eklendi!**`);
} else {
try {
var video = await youtube.getVideo(url);
} catch (error) {
try {
var videos = await youtube.searchVideos(searchString, 10);
let index = 0;
msg.channel.send(`
__**Müzik Seçim Listesi:**__

${videos.map(video2 => `**${++index} -** ${video2.title}`).join('n')}

**:warning: Lütfen 10 Saniye İçerisinde Müzik Seçin Veya tr!çal müzikismi Şeklinde İsim Belirtin :warning: **

**:question: 1-10 arasındaki arama sonuçlarından birini seçmek için lütfen bir değer belirtin. :warning: **
`);
// eslint-disable-next-line max-depth
try {
var response = await msg.channel.awaitMessages(msg2 => msg2.content > 0 && msg2.content < 11, {
maxMatches: 1,
time: 10000,
errors: ['time']
});
} catch (err) {
console.error(err);
return msg.channel.send(':x:** Bir Değer Seçilmediği İçin Video Seçimi İptal Edilmiştir.**');
}
const videoIndex = parseInt(response.first().content);
var video = await youtube.getVideoByID(videos[videoIndex - 1].id);
} catch (err) {
console.error(err);
return msg.channel.send(':x:** Aradım Ama Hiç Bir Şey Bulamadım. Üzgünüm!**');
}
}
return handleVideo(video, msg, voiceChannel);
}
} else if (command === 'geç') {
if (!msg.member.voiceChannel) return msg.channel.send('**:mute:Sesli Bir Odada Değilsiniz Lütfen Bir Odaya Giriniz!**');
if (!serverQueue) return msg.channel.send(':x: **Hiç Bir Müzik Çalmamakta.**');
serverQueue.connection.dispatcher.end('**Müziği Geçtim!**');
return undefined;
} else if (command === 'dur') {
if (!msg.member.voiceChannel) return msg.channel.send('**:mute:Sesli Bir Odada Değilsiniz Lütfen Bir Odaya Giriniz!**');
if (!serverQueue) return msg.channel.send(':x: **Hiç Bir Müzik Çalmamakta.**');
msg.channel.send(`:stop_button: **${serverQueue.songs[0].title}** Adlı Müzik Durduruldu`);
serverQueue.songs = [];
serverQueue.connection.dispatcher.end('**Müzik Bitti**');
return undefined;
} else if (command === 'ses') {
if (!msg.member.voiceChannel) return msg.channel.send('**:mute:Sesli Bir Odada Değilsiniz Lütfen Bir Odaya Giriniz!**');
if (!serverQueue) return msg.channel.send(':x: **Hiç Bir Müzik Çalmamakta.**');
if (!args[1]) return msg.channel.send(`:loud_sound: Şuanki Ses Seviyesi: **${serverQueue.volume}**`);
serverQueue.volume = args[1];
serverQueue.connection.dispatcher.setVolumeLogarithmic(args[1] / 5);
return msg.channel.send(`:loud_sound: Ses Seviyesi Ayarlanıyor: **${args[1]}**`);
} else if (command === 'çalan') {
if (!serverQueue) return msg.channel.send(':x: **Çalan Müzik Bulunmamakta**');
return msg.channel.send(`🎶 Şuanda Çalan Müzik: **${serverQueue.songs[0].title}**`);
} else if (command === 'kuyruk') {
if (!serverQueue) return msg.channel.send(':x: **Çalan Müzik Bulunmamakta**');
return msg.channel.send(`
__**Müzik Listesi:**__

**:warning: Lütfen 10 Saniye İçerisinde Müzik Seçiniz.Aksi Takdirde Liste İptal Olacaktır! :warning: **

${serverQueue.songs.map(song => `**-** ${song.title}`).join('n')}
**Şuanda Çalan Müzik:** ${serverQueue.songs[0].title}
`);
} else if (command === 'duraklat') {
if (serverQueue && serverQueue.playing) {
serverQueue.playing = false;
serverQueue.connection.dispatcher.pause();
return msg.channel.send('**⏸ Müzik Senin İçin Durduruldu!**');
}
return msg.channel.send(':x: **Çalan Müzik Bulunmamakta**');
} else if (command === 'devam') {
if (serverQueue && !serverQueue.playing) {
serverQueue.playing = true;
serverQueue.connection.dispatcher.resume();
return msg.channel.send('**▶ Müzik Senin İçin Devam Etmekte!**');
}
return msg.channel.send(':x: Çalan Müzik Bulunmamakta.');
}

return undefined;
});

async function handleVideo(video, msg, voiceChannel, playlist = false) {
const serverQueue = queue.get(msg.guild.id);
console.log(video);
const song = {
id: video.id,
title: (video.title),
url: `https://www.youtube.com/watch?v=${video.id}`
};
if (!serverQueue) {
const queueConstruct = {
textChannel: msg.channel,
voiceChannel: voiceChannel,
connection: null,
songs: [],
volume: 5,
playing: true
};
queue.set(msg.guild.id, queueConstruct);

queueConstruct.songs.push(song);

try {
var connection = await voiceChannel.join();
queueConstruct.connection = connection;
play(msg.guild, queueConstruct.songs[0]);
} catch (error) {
console.error(`:x: **Odaya Girememekteyim: ${error}**`);
queue.delete(msg.guild.id);
return msg.channel.send(`:x: **Odaya Girememekteyim: ${error}**`);
}
} else {
serverQueue.songs.push(song);
console.log(serverQueue.songs);
if (playlist) return undefined;
else return msg.channel.send(`✅ **${song.title}** Adlı Müzik Kuyruğa Eklendi!`);
}
return undefined;
}

function play(guild, song) {
const serverQueue = queue.get(guild.id);

if (!song) {
serverQueue.voiceChannel.leave();
queue.delete(guild.id);
return;
}
console.log(serverQueue.songs);

const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
.on('end', reason => {
if (reason === ':x: **Yayın Akış Hızı Yeterli Değil.**') console.log('Müzik Bitti.');
else console.log(reason);
serverQueue.songs.shift();
play(guild, serverQueue.songs[0]);
})
.on('error', error => console.error(error));
dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);

serverQueue.textChannel.send(`🎶 : **${song.title}** Adlı Müzik Başlıyor! :white_check_mark: `);
}

client.on('guildMemberAdd', member => {
console.log('Kullanıcı ' + member.user.username + '#' + member.user.discriminator + ' Sunucuya Katıldı! ')
})

client.elevation = message => {
if(!message.guild) {
return; }
let permlvl = 0;
if (message.member.hasPermission("BAN_MEMBERS")) permlvl = 2;
if (message.member.hasPermission("ADMINISTRATOR")) permlvl = 3;
if (message.author.id === ayarlar.sahip) permlvl = 4;
return permlvl;
};

var regToken = /[wd]{24}.[wd]{6}.[wd-_]{27}/g;

client.on('warn', e => {
console.log(chalk.bgYellow(e.replace(regToken, 'that was redacted')));
});

client.on('error', e => {
console.log(chalk.bgRed(e.replace(regToken, 'that was redacted')));
});

client.login(ayarlar.token);
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.