Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Enmap = require("enmap") // npm i enmap + swy mlf times.json w 7t fyh {}
- db = new Enmap({name: "fireking"}),
- times = require("./times.json"),
- owners = ["387107653148475393"]
- client["on"]("message", async message => {
- if(message["author"]["bot"] || message["channel"]["type"] === "dm") return undefined;
- let args = message["content"]["split"](' ');
- db["ensure"](`vip${client["user"]["id"]}`,{
- vipownership: [],
- vipotherownership: [],
- vippremiumnumber: 1,
- vipguild: "",
- vipprefix: "-"
- })
- if(!owners["includes"](message["author"]["id"])) return undefined
- if(args[0]["toLowerCase"]() == prefix + `vipmove`) { // هنا علشان تنقل البوت لشخص مع تحديد الاونر الاساسي و تحديد رقم البريميوم و تحديد السيرفر و تحديد البرفكس
- let ownership = message["mentions"]["users"]["first"]()
- let premiumnumber = message["content"]["split"](" ")[2]
- let guild = message["content"]["split"](" ")[3]
- let prefix = message["content"]["split"](" ")[4]
- if(ownership === message["author"]["bot"]) return message["channel"]["send"](`**❌ | Error**`)
- if(!guild || !ownership || !premiumnumber || !prefix) return message["channel"]["send"](`**✅ | Using: \`-vipmove [MentionUser] [PremiumNumber] [GuildID] [Prefix]\`**`)
- db["pushIn"](`vip${client["user"]["id"]}`, "vipownership" , ownership);
- db["set"](`vip${client["user"]["id"]}`, "vippremiumnumber", premiumnumber)
- db["set"](`vip${client["user"]["id"]}`, "vipguild", guild)
- db["set"](`vip${client["user"]["id"]}`, "vipprefix", prefix)
- ownership["send"](`**Link: ${await client["generateInvite"]("ADMINISTRATOR")}
- سيتم خذف الرساله بعد 2 دقائق**`)["then"](e => e["delete"](2*60*1000))
- message["channel"]["send"](`**✅ | Done**`)
- }
- })
- client["on"]("message", async message => {
- if(message["author"]["bot"] || message["channel"]["type"] === "dm") return undefined;
- let args = message["content"]["split"](' ');
- if(db["get"](`vip${client["user"]["id"]}`, 'vipownership') !== message["author"]["id"]) return undefined;
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}viptransfer`) { // هنا لنقل ملكية البوت
- let ownerships = message["mentions"]["users"]["first"]()
- if(ownerships === message["author"]["bot"]) return message["channel"]["send"](`**❌ | Error**`)
- if(ownerships === message["author"]) return message["channel"]["send"](`**❌ | Error**`)
- if(!ownerships) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}viptransfer [MentionUser]\`**`)
- db["remove"](`vip${client["user"]["id"]}`, db["get"](`vip${client["user"]["id"]}`, 'vipownership'), "vipownership");
- db["pushIn"](`vip${client["user"]["id"]}`, "vipownership", ownerships);
- ownerships["send"](`**Link: ${await client["generateInvite"]("ADMINISTRATOR")}
- سيتم خذف الرساله بعد 2 دقائق**`)["then"](e => e["delete"](2*60*1000))
- message["channel"]["send"](`**✅ | Done**`)
- }
- })
- client["on"]("message", async message => {
- if(message["author"]["bot"] || message["channel"]["type"] === "dm") return undefined;
- let args = message["content"]["split"](' ');
- if(db["get"](`vip${client["user"]["id"]}`, 'vipownership') !== message["author"]["id"]) return undefined;
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}add-otherownership`) { // هنا لأضافة اونرات اخري
- let otherownerships = message["mentions"]["users"]["first"]()
- if(otherownerships === message["author"]["bot"]) return message["channel"]["send"](`**❌ | Error**`)
- if(otherownerships === message["author"]) return message["channel"]["send"](`**❌ | Error**`)
- if(!otherownerships) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}add-otherownership [MentionUser]\`**`)
- db["pushIn"](`vip${client["user"]["id"]}`, "vipotherownership", otherownerships);
- message["channel"]["send"](`**✅ | Done**`)
- }
- })
- client["on"]("message", async message => {
- if(message["author"]["bot"] || message["channel"]["type"] === "dm") return undefined;
- let args = message["content"]["split"](' ');
- if(db["get"](`vip${client["user"]["id"]}`, 'vipownership') !== message["author"]["id"]) return undefined;
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}remove-otherownership`) { // هنا لأزالة اونر
- let otherownerships = message["mentions"]["users"]["first"]()
- if(otherownerships === message["author"]["bot"]) return message["channel"]["send"](`**❌ | Error**`)
- if(otherownerships === message["author"]) return message["channel"]["send"](`**❌ | Error**`)
- if(!otherownerships) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}remove-otherownership [MentionUser]\`**`)
- db["remove"](`vip${client["user"]["id"]}`, otherownerships, "vipotherownership");
- message["channel"]["send"](`**✅ | Done**`)
- }
- })
- async function save() {
- require("fs")["writeFileSync"]("./times.json", JSON.stringify(times), function (error) {
- if(error) throw error;
- })
- };
- client["on"]("ready", async function () {
- if(!times[client ["user"]["id"]]) times [client["user"]["id"]] = {
- time: require("ms")("30d")
- };
- save();
- setInterval(() => {
- times[client["user"]["id"]].time -= require("ms")("1s");
- save();
- }, 1000);
- });
- client["on"]('message', async message => {
- if(message["author"]["bot"]) return undefined;
- let args = message["content"]["split"](' ');
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}vip`) { // هنا يعرض لك معلومات البريموم
- if(!times [client["user"]["id"]]) {
- times [client["user"]["id"]] = {
- time: require("ms")("30d")
- };
- save();
- process["exit"](1)["then"](() => {
- message["channel"]["send"]("**restarting the bot to save the premium time please wait..**");
- });
- } else {
- message["channel"]["send"](`**> Premiumnumber: \`\`${db["get"](`vip${client["user"]["id"]}`, 'vippremiumnumber')}\`\` | Prefix: \`\`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}\`\`
- > Ownership: ${db["get"](`vip${client["user"]["id"]}`, 'vipownership')["join"](" | ")}
- > OtherOwnership(s): ${db["get"](`vip${client["user"]["id"]}`, 'vipotherownership')["join"](" | ") || "No othership"}
- > End At: \`${require("countdown")(Date.now() + times [client["user"]["id"]]["time"])["toString"]()}\`** `)
- }
- }
- })
- client["on"]("message", async message => {
- if(message["author"]["bot"]) return undefined;
- let args = message["content"]["split"](' ');
- var argresult = message["content"]["split"](` `)["slice"](1)["join"](' ');
- if(db["get"](`vip${client["user"]["id"]}`, 'vipownership') !== message["author"]["id"]) return undefined;
- if(db["get"](`vip${client["user"]["id"]}`, 'vipotherownership') !== message["author"]["id"]) return undefined;
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setplaying`) {
- if(!argresult) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setplaying [Game]\`**`);
- client["user"]["setGame"](argresult);
- message["channel"]["send"](`**✅ Changed the Bot Playing to » \`${argresult}\`**`)
- } else
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setwatch`) {
- if(!argresult) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setwatch [Game]\`**`);
- client["user"]["setActivity"](argresult, {type:'WATCHING'});
- message["channel"]["send"](`**✅ Changed the Bot Watching to » \`${argresult}\`**`)
- } else
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setlisten`) {
- if(!argresult) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setlisten [Game]\`**`);
- client["user"]["setActivity"](argresult , {type:'LISTENING'});
- message["channel"]["send"](`**✅ Changed the Bot Listening to » \`${argresult}\`**`)
- } else
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setstream`) {
- if(!argresult) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setstream [Game]\`**`);
- client["user"]["setGame"](argresult, "https://www.twitch.tv/P");
- message["channel"]["send"](`**✅ Changed the Bot Streaming to » \`${argresult}\`**`)
- }
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setname`) {
- if(!argresult) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setname [Name]\`**`);
- client["user"]["setUsername"](argresult)["then"]
- message["channel"]["send"](`**✅ Changed the Bot Name to » \`${argresult}\`**`)
- } else
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setavatar`) {
- if(!argresult) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setavatar [URL]\`**`);
- client["user"]["setAvatar"](argresult);
- message["channel"]["send"](`**✅ Changed the Bot Avatar to » \`${argresult}\`**`);
- } else
- if(args[0]["toLowerCase"]() == `${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setprefix`) {
- if(!argresult) return message["channel"]["send"](`**✅ | Using: \`${db["get"](`vip${client["user"]["id"]}`, 'vipprefix')}setprefix [Prefix]\`**`);
- db["set"](`vip${client["user"]["id"]}`, "vipprefix", argresult)
- message["channel"]["send"](`**✅ Changed the Bot Prefix to » \`${argresult}\`**`)
- }
- })
- client["on"]("guildCreate", async function(guild) {
- if(guild["id"] !== db["get"](`vip${client["user"]["id"]}`, 'vipguild'))
- guild["leave"]();
- })
- const ownerID = ["387107653148475393"]; // ايدي ادارة البوت او صاحب البوت ..
- client.commands = new Discord.Collection();
- client.aliases = new Discord.Collection();
- let cmds = {
- play: { cmd: 'play', a: ['p'] },
- skip: { cmd: 'skip', a: ['s'] },
- stop: { cmd: 'stop' },
- pause: { cmd: 'pause' },
- resume: { cmd: 'resume', a: ['r'] },
- volume: { cmd: 'volume', a: ['vol'] },
- queue: { cmd: 'queue', a: ['q'] },
- repeat: { cmd: 'repeat', a: ['re'] },
- forceskip: { cmd: 'forceskip', a: ['fs', 'fskip'] },
- skipto: { cmd: 'skipto', a: ['st'] },
- nowplaying: { cmd: 'Nowplaying', a: ['np'] }
- };
- Object.keys(cmds).forEach(key => {
- var value = cmds[key];
- var command = value.cmd;
- client.commands.set(command, command);
- if(value.a) {
- value.a.forEach(alias => {
- client.aliases.set(alias, command)
- })
- }
- })
- let active = new Map();
- client.on('warn', console.warn);
- client.on('error', console.error);
- client.on('ready', () => {
- console.log(`Created By: Kahrbaa`);
- console.log(`Guilds: ${client.guilds.size}`);
- console.log(`Users: ${client.users.size}`);
- client.user.setActivity(`Type ${prefix}help`,{type: 'Playing'});
- });
- client.on('message', async msg => {
- if(msg.author.bot) return undefined;
- if(!msg.content.startsWith(prefix)) return undefined;
- const args = msg.content.slice(prefix.length).trim().split(/ +/g);
- const command = args.shift().toLowerCase();
- const url = args[1] ? args[1].replace(/<(.+)>/g, '$1') : '';
- let cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command))
- let s;
- if(cmd === 'play') {
- const voiceChannel = msg.member.voiceChannel;
- if(!voiceChannel) return msg.channel.send(`:no_entry_sign: You must be listening in a voice channel to use that!`);
- const permissions = voiceChannel.permissionsFor(msg.client.user);
- if(!permissions.has('CONNECT')) {
- return msg.channel.send(`:no_entry_sign: I can't join Your voiceChannel because i don't have ` + '`' + '`CONNECT`' + '`' + ` permission!`);
- }
- if(!permissions.has('SPEAK')) {
- return msg.channel.send(`:no_entry_sign: I can't SPEAK in your voiceChannel because i don't have ` + '`' + '`SPEAK`' + '`' + ` permission!`);
- }
- 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(`Added to queue: ${playlist.title}`);
- } else {
- try {
- var video = await youtube.getVideo(url);
- } catch (error) {
- try {
- var videos = await youtube.searchVideos(args, 1);
- // eslint-disable-next-line max-depth
- var video = await youtube.getVideoByID(videos[0].id);
- } catch (err) {
- console.error(err);
- return msg.channel.send('I can\'t find any thing');
- }
- }
- return handleVideo(video, msg, voiceChannel);
- }
- async function handleVideo(video, msg, voiceChannel, playlist = false) {
- const serverQueue = active.get(msg.guild.id);
- // console.log('yao: ' + Util.escapeMarkdown(video.thumbnailUrl));
- let hrs = video.duration.hours > 0 ? (video.duration.hours > 9 ? `${video.duration.hours}:` : `0${video.duration.hours}:`) : '';
- let min = video.duration.minutes > 9 ? `${video.duration.minutes}:` : `0${video.duration.minutes}:`;
- let sec = video.duration.seconds > 9 ? `${video.duration.seconds}` : `0${video.duration.seconds}`;
- let dur = `${hrs}${min}${sec}`
- let ms = video.durationSeconds * 1000;
- const song = {
- id: video.id,
- title: video.title,
- duration: dur,
- msDur: ms,
- url: `https://www.youtube.com/watch?v=${video.id}`
- };
- if (!serverQueue) {
- const queueConstruct = {
- textChannel: msg.channel,
- voiceChannel: voiceChannel,
- connection: null,
- songs: [],
- volume: 50,
- requester: msg.author,
- playing: true,
- repeating: false
- };
- active.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(`I could not join the voice channel: ${error}`);
- active.delete(msg.guild.id);
- return msg.channel.send(`I cant join this voice channel`);
- }
- } else {
- serverQueue.songs.push(song);
- if (playlist) return undefined;
- if(!args) return msg.channel.send('no results.');
- else return msg.channel.send(':watch: Loading... [`' + args + '`]').then(m => {
- setTimeout(() => {//:watch: Loading... [let]
- m.edit(`:notes: Added **${song.title}**` + '(` ' + song.duration + ')`' + ` to the queue at position ` + `${serverQueue.songs.length}`);
- }, 500)
- })
- }
- return undefined;
- }
- function play(guild, song) {
- const serverQueue = active.get(guild.id);
- if (!song) {
- serverQueue.voiceChannel.leave();
- active.delete(guild.id);
- return;
- }
- //console.log(serverQueue.songs);
- if(serverQueue.repeating) {
- console.log('Repeating');
- } else {
- serverQueue.textChannel.send(':notes: Added **' + song.title + '** (`' + song.duration + '`) to begin playing.');
- }
- const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
- .on('end', reason => {
- //if (reason === 'Stream is not generating quickly enough.') console.log('Song ended.');
- //else console.log(reason);
- if(serverQueue.repeating) return play(guild, serverQueue.songs[0])
- serverQueue.songs.shift();
- play(guild, serverQueue.songs[0]);
- })
- .on('error', error => console.error(error));
- dispatcher.setVolumeLogarithmic(serverQueue.volume / 100);
- }
- } else if(cmd === 'stop') {
- if(msg.guild.me.voiceChannel !== msg.member.voiceChannel) return msg.channel.send(`You must be in ${msg.guild.me.voiceChannel.name}`)
- if(!msg.member.hasPermission('ADMINISTRATOR')) {
- msg.react('❌')
- return msg.channel.send('You don\'t have permission `ADMINSTRATOR`');
- }
- let queue = active.get(msg.guild.id);
- if(queue.repeating) return msg.channel.send('Repeating Mode is on, you can\'t stop the music, run `' + `${prefix}repeat` + '` to turn off it.')
- queue.songs = [];
- queue.connection.dispatcher.end();
- return msg.channel.send(':notes: The player has stopped and the queue has been cleared.');
- } else if(cmd === 'skip') {
- let vCh = msg.member.voiceChannel;
- let queue = active.get(msg.guild.id);
- if(!vCh) return msg.channel.send('Sorry, but you can\'t because you are not in voice channel');
- if(!queue) return msg.channel.send('No music playing to skip it');
- if(queue.repeating) return msg.channel.send('You can\'t skip it, because repeating mode is on, run ' + `\`${prefix}forceskip\``);
- let req = vCh.members.size - 1;
- if(req == 1) {
- msg.channel.send('**:notes: Skipped **' + args);
- return queue.connection.dispatcher.end('Skipping ..')
- }
- if(!queue.votes) queue.votes = [];
- if(queue.votes.includes(msg.member.id)) return msg.say(`You already voted for skip! ${queue.votes.length}/${req}`);
- queue.votes.push(msg.member.id);
- if(queue.votes.length >= req) {
- msg.channel.send('**:notes: Skipped **' + args);
- delete queue.votes;
- return queue.connection.dispatcher.end('Skipping ..')
- }
- msg.channel.send(`**You have successfully voted for skip! ${queue.votes.length}/${req}**`)
- } else if(cmd === 'pause') {
- let queue = active.get(msg.guild.id);
- let vCh = msg.member.voiceChannel;
- if(!vCh || vCh !== msg.guild.me.voiceChannel) return msg.channel.send(`You are not in my voice channel.`);
- if(!queue) {
- return msg.channel.send('No music playing to pause.')
- }
- if(!queue.playing) return msg.channel.send(':no_entry_sign: There must be music playing to use that!')
- let disp = queue.connection.dispatcher;
- disp.pause('Pausing..')
- queue.playing = false;
- msg.channel.send(':notes: Paused ' + args + '. **Type** `' + prefix + 'resume` to unpause!')
- } else if (cmd === 'resume') {
- let queue = active.get(msg.guild.id);
- let vCh = msg.member.voiceChannel;
- if(!vCh || vCh !== msg.guild.me.voiceChannel) return msg.channel.send(`You are not in my voice channel.`);
- if(!queue) return msg.channel.send(':notes: No music paused to resume.')
- if(queue.playing) return msg.channel.send(':notes: No music paused to resume.')
- let disp = queue.connection.dispatcher;
- disp.resume('Resuming..')
- queue.playing = true;
- msg.channel.send(':notes: Resumed.')
- } else if(cmd === 'volume') {
- let queue = active.get(msg.guild.id);
- if(!queue || !queue.songs) return msg.channel.send(':notes: There is no music playing to set volume.');
- let vCh = msg.member.voiceChannel;
- if(!vCh || vCh !== msg.guild.me.voiceChannel) return msg.channel.send(':notes: You are not in my voice channel');
- let disp = queue.connection.dispatcher;
- if(isNaN(args[0])) return msg.channel.send(':notes: Numbers only!');
- if(parseInt(args[0]) > 100) return msg.channel.send('You can\'t set the volume more than 100.')
- //:speaker: Volume changed from 20 to 20 ! The volume has been changed from ${queue.volume} to ${args[0]}
- msg.channel.send(':speaker: Volume has been **changed** from (`' + queue.volume + '`) to (`' + args[0] + '`)');
- queue.volume = args[0];
- disp.setVolumeLogarithmic(queue.volume / 100);
- } else if (cmd === 'queue') {
- let queue = active.get(msg.guild.id);
- if(!queue) return msg.channel.send(':no_entry_sign: There must be music playing to use that!');
- let embed = new Discord.RichEmbed()
- .setAuthor(`${client.user.username}`, client.user.displayAvatarURL)
- let text = '';
- for (var i = 0; i < queue.songs.length; i++) {
- let num;
- if((i) > 8) {
- let st = `${i+1}`
- let n1 = converter.toWords(st[0])
- let n2 = converter.toWords(st[1])
- num = `:${n1}::${n2}:`
- } else {
- let n = converter.toWords(i+1)
- num = `:${n}:`
- }
- text += `${num} ${queue.songs[i].title} [${queue.songs[i].duration}]\n`
- }
- embed.setDescription(`Songs Queue | ${msg.guild.name}\n\n ${text}`)
- msg.channel.send(embed)
- } else if(cmd === 'repeat') {
- let vCh = msg.member.voiceChannel;
- if(!vCh || vCh !== msg.guild.me.voiceChannel) return msg.channel.send('You are not in my voice channel');
- let queue = active.get(msg.guild.id);
- if(!queue || !queue.songs) return msg.channel.send('There is no music playing to repeat it.');
- if(queue.repeating) {
- queue.repeating = false;
- return msg.channel.send(':arrows_counterclockwise: **Repeating Mode** (`False`)');
- } else {
- queue.repeating = true;
- return msg.channel.send(':arrows_counterclockwise: **Repeating Mode** (`True`)');
- }
- } else if(cmd === 'forceskip') {
- let vCh = msg.member.voiceChannel;
- if(!vCh || vCh !== msg.guild.me.voiceChannel) return msg.channel.send('You are not in my voice channel');
- let queue = active.get(msg.guild.id);
- if(queue.repeating) {
- queue.repeating = false;
- msg.channel.send('ForceSkipped, Repeating mode is on.')
- queue.connection.dispatcher.end('ForceSkipping..')
- queue.repeating = true;
- } else {
- queue.connection.dispatcher.end('ForceSkipping..')
- msg.channel.send('ForceSkipped.')
- }
- } else if(cmd === 'skipto') {
- let vCh = msg.member.voiceChannel;
- if(!vCh || vCh !== msg.guild.me.voiceChannel) return msg.channel.send('You are not in my voice channel');
- let queue = active.get(msg.guild.id);
- if(!queue.songs || queue.songs < 2) return msg.channel.send('There is no music to skip to.');
- if(queue.repeating) return msg.channel.send('You can\'t skip, because repeating mode is on, run ' + `\`${prefix}repeat\` to turn off.`);
- if(!args[0] || isNaN(args[0])) return msg.channel.send('Please input song number to skip to it, run ' + prefix + `queue` + ' to see songs numbers.');
- let sN = parseInt(args[0]) - 1;
- if(!queue.songs[sN]) return msg.channel.send('There is no song with this number.');
- let i = 1;
- msg.channel.send(`Skipped to: **${queue.songs[sN].title}[${queue.songs[sN].duration}]**`)
- while (i < sN) {
- i++;
- queue.songs.shift();
- }
- queue.connection.dispatcher.end('SkippingTo..')
- } else if(cmd === 'Nowplaying') {
- let q = active.get(msg.guild.id);
- let now = npMsg(q)
- msg.channel.send(now.mes, now.embed)
- .then(me => {
- setInterval(() => {
- let noww = npMsg(q)
- me.edit(noww.mes, noww.embed)
- }, 5000)
- })
- function npMsg(queue) {
- let m = !queue || !queue.songs[0] ? 'No music playing.' : "Now Playing..."
- const eb = new Discord.RichEmbed();
- eb.setColor(msg.guild.me.displayHexColor)
- if(!queue || !queue.songs[0]){
- eb.setTitle("No music playing");
- eb.setDescription("\u23F9 "+bar(-1)+" "+volumeIcon(!queue?100:queue.volume));
- } else if(queue.songs) {
- if(queue.requester) {
- let u = msg.guild.members.get(queue.requester.id);
- if(!u)
- eb.setAuthor('Unkown (ID:' + queue.requester.id + ')')
- else
- eb.setAuthor(u.user.tag, u.user.displayAvatarURL)
- }
- if(queue.songs[0]) {
- try {
- eb.setTitle(queue.songs[0].title);
- eb.setURL(queue.songs[0].url);
- } catch (e) {
- eb.setTitle(queue.songs[0].title);
- }
- }
- eb.setDescription(embedFormat(queue))
- }
- return {
- mes: m,
- embed: eb
- }
- }
- function embedFormat(queue) {
- if(!queue || !queue.songs) {
- return "No music playing\n\u23F9 "+bar(-1)+" "+volumeIcon(100);
- } else if(!queue.playing) {
- return "No music playing\n\u23F9 "+bar(-1)+" "+volumeIcon(queue.volume);
- } else {
- let progress = (queue.connection.dispatcher.time / queue.songs[0].msDur);
- let prog = bar(progress);
- let volIcon = volumeIcon(queue.volume);
- let playIcon = (queue.connection.dispatcher.paused ? "\u23F8" : "\u25B6")
- let dura = queue.songs[0].duration;
- return playIcon + ' ' + prog + ' `[' + formatTime(queue.connection.dispatcher.time) + '/' + dura + ']`' + volIcon;
- }
- }
- function formatTime(duration) {
- var milliseconds = parseInt((duration % 1000) / 100),
- seconds = parseInt((duration / 1000) % 60),
- minutes = parseInt((duration / (1000 * 60)) % 60),
- hours = parseInt((duration / (1000 * 60 * 60)) % 24);
- hours = (hours < 10) ? "0" + hours : hours;
- minutes = (minutes < 10) ? "0" + minutes : minutes;
- seconds = (seconds < 10) ? "0" + seconds : seconds;
- return (hours > 0 ? hours + ":" : "") + minutes + ":" + seconds;
- }
- function bar(precent) {
- var str = '';
- for (var i = 0; i < 12; i++) {
- let pre = precent
- let res = pre * 12;
- res = parseInt(res)
- if(i == res){
- str+="\uD83D\uDD18";
- }
- else {
- str+="▬";
- }
- }
- return str;
- }
- function volumeIcon(volume) {
- if(volume == 0)
- return "\uD83D\uDD07";
- if(volume < 30)
- return "\uD83D\uDD08";
- if(volume < 70)
- return "\uD83D\uDD09";
- return "\uD83D\uDD0A";
- }
- }
- });
- client.on('message', message => {
- if (!message.guild) return;
- if (message.content === prefix + 'join') {
- if (message.member.voiceChannel) {
- message.member.voiceChannel.join()
- .then(connection => {
- message.reply('**ابشر انا معاك ف الروم الان ..**!');
- })
- .catch(console.log);
- } else {
- message.reply('**- لازم تخش روم صوتي!**');
- }
- }
- });
- client.on('message', message => {
- var helplist = `**:notes: قائمة الاوامر:
- > Play : تشغيل الاغنية او اضافتها للقائمة او اكمال الاغنية [p]
- > Pause : ايقاف مؤقت الاغنية
- > Resume : اكمال الاغنية
- > stop : لأيقاف الأغنية وخروج البوت من الروم
- > forceskip : لتخطي الأغنية بشكل مباشر
- > Queue : عرض القائمة
- > skipto : لتخطي الأغنية الى الأغنية القادمة في طابور الموسيقى القادمة
- > Skip : تخطي للاغنية التالية
- > Volume : تغيير الصوت [vol]
- > Nowplaying : عرض مايتم تشغيله الان [np]
- > Ping : سرعة استجابة البوت
- > repeat : تكرار الاغنية
- > Leave : الخروج من الروم الصوتي
- `
- if(message.content === prefix + 'help') {
- message.delete(1000)
- let e = '** جاري الارســال .. :envelope_with_arrow: **'
- message.reply(e).then(m => m.delete(1000))
- message.author.send(helplist).catch(error => message.reply('** لم اتمكن من الارسال الاوامر لك , يرجي فتح خاصك :negative_squared_cross_mark:**'))
- }
- });
- var userid = "387107653148475393",
- category = "660529483052220427",
- rolename = "Vip",
- price = 1000;//السعر
- client.on ("message",async message => {
- if (message.author.bot) return;
- if (!message.guild) return;
- if (!message.content.startsWith(prefix)) return;
- const args = message.content.slice(prefix.length).trim().split(/ +/g);
- const cmd = args.shift().toLowerCase();
- if(cmd === "private") {
- let room = args.join(" ");
- let embed = new Discord.RichEmbed()
- .setTitle(`**${message.author.username} - Welcome**`)
- .setDescription(`**Please Transfer ${price} Probot
- To : <@${userid}>**`)
- message.channel.send(embed)
- let P2 = Math.floor (price - (price * (5 / 100))) // xD
- let filter = response => response.author.id == "282859044593598464" && response.mentions._content.includes(`:moneybag: | ${message.author.username}, has transferred \`$${P2}\` to <@${userid}>`)
- message.channel.awaitMessages(filter, { maxMatches: 1, time: 240000, errors: ['time'] })
- .then( collected =>{
- let filter2 = m => m.author.id === message.author.id;
- let thisMessage;
- let thisFalse;
- message.channel.send('📝 **| من فضلك اكتب اسم الروم الان... ✏ **').then(msg => {
- message.channel.awaitMessages(filter2, {
- max: 1,
- time: 180000,
- errors: ['time']
- })
- .then(collected => {
- collected.first().delete();
- thisMessage = collected.first().content;
- let boi;
- message.channel.send(`done !`)
- var role = message.guild.roles.find(role => role.name === rolename);
- message.member.addRole(role);
- let room = collected.first().content
- message.guild.createChannel(room, "text").then(c => {
- let role2 = message.guild.roles.find("name", "@everyone");
- c.overwritePermissions(role2, {
- SEND_MESSAGES: false,
- READ_MESSAGES: true
- });
- c.overwritePermissions(message.author, {
- SEND_MESSAGES: true,
- READ_MESSAGES: true,
- MENTION_EVERYONE:true
- });
- let embed2 = new RichEmbed()
- .setTitle(`**${message.author.username}**`)
- .setDescription(`Done, Your Private room was created in <#${c.id}>`)
- .setTimestamp()
- message.channel.send(embed2);
- const embed = new Discord.RichEmbed()
- .setColor(0xCF40FA)
- .setTitle(`Room For ${message.author.username}`)
- .setDescription(`Enjoy !`)
- .setTimestamp()
- c.send({
- embed: embed
- });
- c.setParent(category)
- }).catch(console.error);
- message.reply("Done !").then(msg => {
- message.channel.awaitMessages(filter, {
- max: 1,
- time: 90000,
- errors: ['time']
- })
- })
- })
- })
- });
- }
- });
- /*
- let vipKeys = JSON.parse(fs.readFileSync("./vipKeys.json", "utf8"));
- client.on("message", msg=>{
- let id = "387107653148475393"; // ايديك
- let role = "Vip"; // اسم رتبة الفيب
- let Price = 10; // السعر
- let Price2 = Math.floor(Price-(Price*(5/100)));
- if(!Price || Price < 1) return;
- let cmd = msg.content.split(' ')[0];
- if(cmd === `${prefix}buy`){
- if(msg.author.bot) return;
- if(!msg.channel.guild) return;
- let embedvip = new Discord.RichEmbed()
- .setColor("#42f4f4")
- .setAuthor(msg.author.username, msg.author.displayAvatarURL)
- .setThumbnail(msg.author.avatarURL)
- .setTitle("**اختر الطريقة المناسبة لك**")
- .addField("ل شراء الفي اي بي لنفسك","🔱",true )
- .addField("ل شراء الفي اي بي ك هدية","🎁",true)
- .setTimestamp()
- .setFooter(client.user.username,client.user.displayAvatarURL);
- msg.channel.send(embedvip).then(msgs2 =>{
- msgs2.react("🔱").then(()=>{
- msgs2.react("🎁").then(()=>{
- const me = (reaction, user) => reaction.emoji.name === '🔱' && user.id === msg.author.id;
- const gift = (reaction, user) => reaction.emoji.name === '🎁' && user.id === msg.author.id;
- const mec = msgs2.createReactionCollector(me, {time: 120000});
- const giftc = msgs2.createReactionCollector(gift, {time: 120000});
- mec.on("collect", r=>{
- msgs2.delete()
- if(msg.member.roles.find(r=>r.name == role)) return msg.reply("انت تمتلك الرتبة مسبقًا");
- let roleW = msg.guild.roles.find(r=>r.name == role);
- if(!roleW) return msg.reply(`البوت مقفل لعدم وجود رتبة ب أسم \`${role}\``)
- msg.channel.send(`كردت بروبوت\`${Price}\` لديك 4 دقائق لتحويل
- إلى ${msg.guild.members.get(id)}
- `).then( msgs =>{
- const filter = response => response.author.id == "282859044593598464" && response.mentions._content.includes(`:moneybag: | ${msg.author.username}, has transferred \`$${Price2}\` to ${msg.guild.members.get(id)}`);
- msg.channel.awaitMessages(filter, { maxMatches: 1, time: 240000, errors: ['time'] })
- .then( collected =>{
- msgs.delete()
- msg.reply(`تم اعطائك رتبة \`${role}\``);
- msg.member.addRole(roleW);
- }).catch(e => {});
- })})
- giftc.on("collect", r=>{
- msgs2.delete()
- let roleW = msg.guild.roles.find(r=>r.name == role);
- if(!roleW) return msg.reply(`البوت مقفل لعدم وجود رتبة ب أسم \`${role}\``)
- msg.channel.send(`كردت بروبوت\`${Price}\` لديك 4 دقائق لتحويل
- إلى ${msg.guild.members.get(id)}
- `).then( msgs =>{
- const filter = response => response.author.id == "282859044593598464" && response.mentions._content.includes(`:moneybag: | ${msg.author.username}, has transferred \`$${Price2}\` to ${msg.guild.members.get(id)}`);
- msg.channel.awaitMessages(filter, { maxMatches: 1, time: 240000, errors: ['time'] })
- .then( collected =>{
- msgs.delete()
- genKey(msg,roleW);
- }).catch(e => {});
- })
- })
- })})})
- ///
- }
- if(cmd === `${prefix}used`){
- let args = msg.content.split(" ").slice(1)[0];
- if(!args) {
- let embed = new Discord.RichEmbed()
- .setColor("#42f4f4")
- .setTitle(`:x: - **الرجاء ادخال كود الهدية** \`${prefix}used <Key>\``)
- msg.reply(embed).then( z => z.delete(3000));
- return
- }
- let embed = new Discord.RichEmbed()
- .setTitle(`**جاري التحقق من الكود**`)
- .setColor("#42f4f4")
- msg.reply(embed).then( msgs =>{
- if(vipKeys[args]){
- let hav = msg.member.roles.find(`name`, vipKeys[args].name);
- if(hav){
- let embed = new Discord.RichEmbed()
- .setTitle(`:x: - **انت تمتلك هذه الرتبة مسبقًا** \`${vipKeys[args].name}\``)
- .setColor("#42f4f4")
- msgs.edit(embed)
- return
- }
- let embed = new Discord.RichEmbed()
- .setTitle(`:tada: - **مبروك تم اعطائك رتبة** \`${vipKeys[args].name}\``)
- .setColor("#42f4f4")
- msgs.edit(embed)
- msg.member.addRole(vipKeys[args]);
- delete vipKeys[args]
- save()
- }else{
- let embed = new Discord.RichEmbed()
- .setTitle(`:x: - **الكود غير صيحيح أو انه مستعمل من قبل**`)
- .setColor("#42f4f4")
- msgs.edit(embed)
- }});
- }
- });
- function genKey(msg,role){
- var randomkeys = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- var gift = "";
- for (var y = 0; y < 16; y++) { ///16
- gift += `${randomkeys.charAt(Math.floor(Math.random() * randomkeys.length))}`;
- }
- vipKeys[gift] = role;
- let embed = new Discord.RichEmbed()
- .setColor("#42f4f4")
- .setTitle(`:ok_hand: - **تم ارسآل الكود على الخاص**`);
- msg.reply(embed);
- let embed2= new Discord.RichEmbed()
- .setAuthor(msg.author.username, msg.author.displayAvatarURL)
- .setThumbnail(msg.author.avatarURL)
- .addField("**Key Of Gift**", gift,true)
- .addField("Role",vipKeys[gift].name,true)
- .addField("This Key Made by", msg.author, true)
- .addField("The Room", msg.channel , true)
- .setTimestamp()
- .setFooter(client.user.username,client.user.displayAvatarURL)
- msg.author.send(embed2);
- save()
- }
- function save(){
- fs.writeFile("./vipKeys.json", JSON.stringify(vipKeys), (err) => {
- if (err) console.log(err)
- });
- }
- */
- client.on ("message", async (Message) => {
- if (!Message.guild
- || Message.author.bot)
- return false;
- if (Message.content.startsWith (prefix + "role")) {
- if (!Message.member.hasPermission ("MANAGE_ROLES")) return Message.reply("** You dont have Permissions.**");
- var user = Message.mentions.members.first ();
- if (!user) return Message.reply ("**I can't find this member.**");
- var men = Message.mentions.roles.first() || Message.guild.roles.find(r => r.name.startsWith ( Message.content.split(" ").slice(2).join(" ")));
- if (!men) return Message.reply ("**I can't find this role.**");
- if (user.roles.get (men.id)) {
- user.removeRole(men).then(() => {
- return Message.reply("**Successfully removed " + men + " role from "+user+ " **");
- }).catch(err => err.code == 50013 ? Message.channel.send("**This role is above my role.**") : Message.channel.send(err.message))
- } else {
- user.addRole(men).then(() =>{
- Message.reply("**Successfully added " + men + " role to "+user+ " **")
- }).catch(err => err.code == 50013 ? Message.channel.send("**This role is above my role.**") : Message.channel.send(err.message))
- }
- }
- })
- var categoryID = '660529483052220427';
- var voiceID = '661210220994887690';
- client.on('ready',()=>console.log(`${client.user.tag} is ready`));
- client.on('voiceStateUpdate',(Old,New)=>
- {
- if(New.user.bot) return;
- if(Old.user.bot) return;
- if(New.voiceChannelID == voiceID)
- {
- New.guild.createChannel(New.user.username,'voice').then(set=>
- {
- New.setVoiceChannel(New.guild.channels.get(set.id)).then(()=>
- {
- set.setParent(New.guild.channels.get(categoryID));
- });
- set.overwritePermissions(New.user,
- {
- 'CONNECT':true,'SPEAK':true,
- 'MOVE_MEMBERS':true,'VIEW_CHANNEL':true,
- 'MANAGE_CHANNELS':true,'MANAGE_ROLES_OR_PERMISSIONS':true,
- 'USE_VAD':true,'PRIORITY_SPEAKER':true
- });
- });
- }
- if(Old.voiceChannel)
- {
- Old.guild.channels.forEach(channels=>
- {
- if(channels.parentID == categoryID)
- {
- if(channels.id == voiceID) return;
- if(Old.voiceChannelID == channels.id)
- {
- if(Old.voiceChannel.members.size == 0)
- {
- channels.delete();
- }
- }
- }
- });
- }
- });
- var top = require("./top.json");
- function save() {
- fs.writeFileSync("./top.json", JSON.stringify(top, null, 4));
- }
- client.on("voiceStateUpdate", async function(oldMember, newMember) {
- if (newMember.user.bot) return;
- if (!top[newMember.guild.id]) top[newMember.guild.id] = {};
- if (!top[newMember.guild.id][newMember.user.id]) top[newMember.guild.id][newMember.user.id] = {
- "text": 0,
- "voice": parseInt(Math.random()*10),
- "msgs": 0,
- "id": newMember.user.id
- }
- save();
- if (!oldMember.voiceChannel && newMember.voiceChannel) {
- var addXP = setInterval(async function () {
- top[newMember.guild.id][newMember.user.id].voice+=parseInt(Math.random()*4);
- save();
- if (!newMember.voiceChannel) {
- clearInterval(addXP);
- }
- }, 60000);
- }
- });
- client.on("message", async function (message) {
- if (message.author.bot) return;
- if (!message.guild) return;
- if (!top[message.guild.id]) top[message.guild.id] = {};
- if (!top[message.guild.id][message.author.id]) top[message.guild.id][message.author.id] = {
- "text": parseInt(Math.random()*10),
- "voice": 0,
- "msgs": 0,
- "id": message.author.id
- }
- if (top[message.guild.id][message.author.id].msgs > 10) {
- top[message.guild.id][message.author.id].text += parseInt(Math.random()*4);
- top[message.guild.id][message.author.id].msgs = 0;
- }
- save();
- var args = message.content.split(" ");
- var cmd = args[0].slice(prefix.length).toLowerCase();
- if (!message.content.startsWith(prefix)) return;
- switch (cmd) {
- case "top":
- var topArray = Object.values(top[message.guild.id]);
- var num = 0;
- var textStr = `${topArray.sort((a, b) => b.text - a.text).slice(0, 10).filter(user => user.text > 0 && message.guild.members.get(user.id)).map(function (user) {
- if (user.text > 0) {
- return `**#${++num} | <@${user.id}> XP: \`${user.text}\` **`
- }
- }).join("\n")}`;
- num = 0;
- var voiceStr = `${topArray.sort((a, b) => b.voice - a.voice).slice(0, 10).filter(user => user.voice > 0 && message.guild.members.get(user.id)).map(function (user) {
- if (user.voice > 0) {
- return `**#${++num} | <@${user.id}> XP: \`${user.voice}\` **`
- }
- }).join("\n")}`;
- var embed = new Discord.RichEmbed()
- .setAuthor(message.author.tag, message.author.displayAvatarURL)
- .addField(`**TOP 10 TEXT 💬**`, textStr.length > 1 ? textStr : "» NO TOP TEXT", true)
- .addField(`**TOP 10 VOICE 🎙️**`, voiceStr.length > 1 ? voiceStr : "» NO TOP VOICE", true)
- .setFooter(client.user.tag, client.user.displayAvatarURL)
- .setColor("RANDOM");
- message.channel.send({
- embed: embed
- });
- break;
- case "topvoice":
- var topArray = Object.values(top[message.guild.id]);
- var num = 0;
- var voiceStr = `${topArray.sort((a, b) => b.voice - a.voice).slice(0, 5).filter(user => user.voice > 0 && message.guild.members.get(user.id)).map(function (user) {
- if (user.voice > 0) {
- return `**#${++num} | <@${user.id}> XP: \`${user.voice}\` **`
- }
- }).join("\n")}`;
- var embed = new Discord.RichEmbed()
- .setTitle("**TOP 5 VOICE 🎙️**")
- .setAuthor(message.author.tag, message.author.displayAvatarURL)
- .setDescription(voiceStr.length > 1 ? voiceStr : "» NO TOP VOICE")
- .setFooter(client.user.tag, client.user.displayAvatarURL)
- .setColor("RANDOM");
- message.channel.send({
- embed: embed
- });
- break;
- case "toptext":
- var topArray = Object.values(top[message.guild.id]);
- var num = 0;
- var textStr = `${topArray.sort((a, b) => b.text - a.text).slice(0, 5).filter(user => user.text > 0 && message.guild.members.get(user.id)).map(function (user) {
- if (user.text > 0) {
- return `**#${++num} | <@${user.id}> XP: \`${user.text}\` **`
- }
- }).join("\n")}`;
- var embed = new Discord.RichEmbed()
- .setTitle("**TOP 5 TEXT 💬**")
- .setAuthor(message.author.tag, message.author.displayAvatarURL)
- .setDescription(textStr.length > 1 ? textStr : "» NO TOP TEXT")
- .setFooter(client.user.tag, client.user.displayAvatarURL)
- .setColor("RANDOM");
- message.channel.send({
- embed: embed
- });
- break;
- }
- });
- function forEachObject(obj, func) {
- Object.keys(obj).forEach(function(key) {
- func(key, obj[key]);
- var dat = JSON.parse("{}");
- });
- }
- const xp = JSON.parse(fs.readFileSync("./xp.json", "utf8"));
- const profile = JSON.parse(fs.readFileSync("profile.json", "utf8"));
- const credits = JSON.parse(fs.readFileSync('./credits.json'));
- const creditsPath = './credits.json';
- var time = require("./time.json");
- client.on('message',async message => {
- var Canvas = require('canvas')
- if(message.author.bot || message.channel.type === 'dm') return;
- let args = message.content.split(' ');
- let author = message.author.id;
- if(!credits[author]) credits[author] = {
- credits: 0
- }
- if(!credits[author]) credits[author] = {
- blacklist: false
- }
- fs.writeFileSync(creditsPath, JSON.stringify(credits, null, 4));
- if(credits[message.author.id].blacklist === true) return undefined;
- if(args[0].toLowerCase() == `${prfs}credit` || args[0].toLowerCase() === `${prfs}credits`) {
- const mention = message.mentions.users.first() || client.users.get(args[1]) || message.author;
- const mentionn = message.mentions.users.first() || client.users.get(args[1]);
- if(!args[2]) {
- message.channel.send(`**:money_with_wings: | ${mention.username}, Have Credits \`$${credits[mention.id].credits}\`**`)
- } else if(mentionn && args[2]) {
- if(isNaN(args[2])) return message.channel.send(`**:x: | Error**`);
- if(args[2] < 1) return message.channel.send(`**:x: | Error**`);
- if(mention.bot) return message.channel.send(`**:x: | Error**`);
- if(mentionn.id === message.author.id) return message.channel.send(`**:x: | Error**`);
- if(args[2] > credits[author].credits) return message.channel.send(`**:x: | Error , You Don't Have Enough Credit**`);
- if(args[2].includes("-")) return message.channel.send(`**:x: | Error**`);
- if(args[2].includes(".")) return message.channel.send(`**:x: | Error**`);
- let first = Math.floor(Math.random() * 9);
- let second = Math.floor(Math.random() * 9);
- let third = Math.floor(Math.random() * 9);
- let fourth = Math.floor(Math.random() * 9);
- let num = `${first}${second}${third}${fourth}`;
- let canvas = Canvas.createCanvas(150 , 50)
- let ctx = canvas.getContext('2d');
- const background = await Canvas.loadImage("https://cdn.discordapp.com/attachments/653622087201849375/656070567073415178/PicsArt_12-16-12.49.43.png");
- ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
- let url = message.author.displayAvatarURL.endsWith(".webp") ? message.author.displayAvatarURL.slice(5, -20) + ".gif" : message.author.displayAvatarURL;
- jimp.read(url, (err, ava) => {
- if(err) return console.log(err);
- ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
- if(err) return console.log(err);
- ctx.font = "sans-serif";
- ctx.fontSize = '180px';
- ctx.fillStyle = "#ffffff";
- message.channel.send(`**${message.author.username}, You Will Trans \`$${args[2]}\` To ${mentionn}
- If You Want To Complete Trans Type The Number Above in this image **`).then(essss => {
- ctx.fillText(num, canvas.width / 2.4, canvas.height / 1.7);
- message.channel.sendFile(canvas.toBuffer()).then(m => {
- message.channel.awaitMessages(r => r.author.id === message.author.id, { max: 1, time: 20000, errors:['time'] }).then(collected => {
- if(collected.first().content === num) {
- client.channels.get("668195069513433098").send(`**
- المرسل : ${message.author.username} | (ID: \`${message.author.id}\`)
- المستقبل : ${mentionn.username} | (ID: \`${mentionn.id}\`)
- الكريدتس : \`$${args[2]}\`
- **`);
- message.channel.send(`**:moneybag: | ${message.author.username}, Done Trans \`$${args[2]}\` To ${mentionn}**`);
- mention.send(`**:money_with_wings: | Transfer Receipt** \`\`\`You Have Received \`$${args[2]}\` From User ${message.author.username}; (ID (${message.author.id})\`\`\``);
- m.delete();
- credits[author].credits += Math.floor((-args[2]));
- credits[mentionn.id].credits += Math.floor((+args[2]));
- fs.writeFileSync(creditsPath, JSON.stringify(credits, null, 4));
- } else {
- m.delete();
- essss.delete();
- }
- })
- })
- })
- })
- })
- }else {
- message.channel.send(`**:x: | Error , Please Command True Ex: \`${prfs}redit [MentionUser] [Balance]\`**`);
- }
- }
- if(args[0].toLowerCase() === `${prfs}daily`) {
- let cooldown = 8.64e+7
- let Daily = time[message.author.id]
- if (Daily !== null && cooldown - (Date.now() - Daily) > 0) {
- let times = (cooldown - (Date.now() - Daily));
- message.channel.send(`**:stopwatch: | ${message.author.username}, Please Wait ${pretty(times, {verbose:true})} To Take Your Daily Again.**`);
- fs.writeFile("./time.json", JSON.stringify(time), function(e) {
- if(e)throw e;
- })
- }else{
- let ammount = (300, 500, 100, 200, 120, 150, 350, 320, 220, 250);
- credits[author].credits += ammount;
- time[message.author.id] = Date.now();
- message.channel.send(`**:money_with_wings:| ${message.author.username}, Done You Have Take Your Daily \`$${ammount}\`**`);
- fs.writeFile("./credits.json", JSON.stringify(credits), function(e) {
- if(e)throw e;
- })
- }
- }
- });
- var guildT = '387107653148475393';
- var channelT = '668195069513433098';
- client.on("message", msg => {
- if(msg.author.bot) return undefined
- if(msg.content.startsWith(prfs + "rcredit")) {
- if(!msg.guild.roles.exists("name", "Mange RemoveCredit")) return undefined;
- if(!guildT.includes(msg.guild.id)) return;
- if(!channelT.includes(msg.channel.id)) return;
- let user = client.users.get(msg.content.split(" ")[1])
- let reason = msg.content.split(" ").slice(2).join(" ");
- if(!reason || !user) return msg.channel.send(`**:x: | Error , Please Type Command True Ex : \`${prfs}rcredit [ID] [Reason]\`**`)
- let channell = client.channels.get("653624195149725711")
- channell.send(`**:white_check_mark: | Done I Have Remove \`${credits[user.id].credits}\` Credit From <@${user.id}>, Reason: \`${reason}\` By: <@${msg.author.id}>**`)
- msg.channel.send("**:white_check_mark: | Done.**")
- credits[user.id].credits = 0
- fs.writeFile("./credits.json", JSON.stringify(credits), function(e) {
- if(e)throw e;
- })
- }
- })
- client.on('message',async message => {
- let Fire = message.content.split(" ")[0].substring(prfs.length);
- let mention = message.mentions.users.first() || message.author
- if(Fire === "cg") {
- let args = message.content.split(" ");
- if(!devs.includes(message.author.id)) return;
- if(!args[1] || isNaN(args[1])) return message.reply("**Type Credit**")
- if(!credits[mention.id]) return;
- credits[mention.id].credits += (+args[1]);
- fs.writeFileSync("./credits.json", JSON.stringify(credits));
- console.log(credits[mention.id])
- message.reply(`**Give : \`${args[1]}\`**`);
- } else if(Fire === "cr") {
- let args = message.content.split(" ");
- if(!devs.includes(message.author.id)) return;
- if(!args[1] || isNaN(args[1])) return message.reply("**Type Credit**")
- if(!credits[mention.id]) return;
- credits[mention.id].credits += (-args[1]);
- fs.writeFileSync("./credits.json", JSON.stringify(credits));
- console.log(credits[mention.id])
- message.reply(`**Removed : \`${args[1]}\`**`);
- }
- });
- let level = JSON.parse(fs.readFileSync("./level.json", "utf8"));
- client.on("message", message => {
- if (message.author.bot) return undefined;
- if (!level[message.author.id])
- level[message.author.id] = {
- xp: 0,
- level: 0
- };
- let username = message.author;
- level[message.author.id].xp++;
- let userlevel = level[message.author.id];
- if (userlevel.xp > Math.floor(Math.random() * 250) + 50) {
- userlevel.level++;
- userlevel.xp = 0;
- }
- fs.writeFileSync("./level.json", JSON.stringify(level), function(s) {
- if (s) throw s;
- });
- });
- client.on('message', message => {
- if(!profile[message.author.id]) profile[message.author.id] ={
- points: 0,
- level: 1,
- rep: 0,
- tite: "No Title"
- };
- if(message.author.bot) return;
- profile[message.author.id].points = Math.floor(profile[message.author.id].points+1);
- if(profile[message.author.id].points > 250) {
- profile[message.author.id].points = 0
- profile[message.author.id].level = Math.floor(profile[message.author.id].level+1);
- message.channel.send(`**${message.author.username}, You leveld up to __${profile[message.author.id].level}__**`)
- }
- fs.writeFile('profile.json', JSON.stringify(profile), (err) => {
- if (err) console.error(err);
- })
- })
- client.on('message', message => {
- let tit = message.content.split(" ").slice(1).join(" ");
- if(message.content.startsWith(prefix + "title")) {
- if(!profile[message.author.id].tite) profile[message.author.id].tite = "Hey im using Super"
- if(!tit) {
- message.channel.send("**Usage: <title <something>**");
- } else {
- profile[message.author.id].tite = tit
- message.channel.send(`:ok:`)
- }
- }
- fs.writeFile('profile.json', JSON.stringify(profile), (err) => {
- if (err) console.error(err);
- })
- })
- client.on('message', message => {
- if(message.content.startsWith(prefix + 'rep')) {
- if(!message.channel.guild) return;
- moment.locale('en');
- var getvalueof = message.mentions.users.first()
- if(!getvalueof) return message.channel.send(`**:mag: | ${message.author.username}, the user could not be found. **`);
- if(getvalueof.id == message.author.id) return message.channel.send(`**${message.author.username}, you cant give yourself a reputation !**`)
- if(profile[message.author.id].reps != moment().format('L')) {
- profile[message.author.id].reps = moment().format('L');
- profile[getvalueof.id].rep = Math.floor(profile[getvalueof.id].rep+1);
- message.channel.send(`** :up: | ${message.author.username} has given ${getvalueof} a reputation point!**`)
- } else {
- message.channel.send(`**:stopwatch: | ${message.author.username}, you can raward more reputation ${moment().endOf('day').fromNow()} **`)
- }
- }
- fs.writeFile('profile.json', JSON.stringify(profile), (err) => {
- if (err) console.error(err);
- })
- });
- client.on("message", message => {
- if (message.author.bot) return;
- if(!message.channel.guild) return;
- if (message.content.startsWith(prefix + "profile")) {
- let user = message.mentions.users.first();
- var men = message.mentions.users.first();
- var heg;
- if(men) {
- heg = men
- } else {
- heg = message.author
- }
- var mentionned = message.mentions.members.first();
- var h;
- if(mentionned) {
- h = mentionned
- } else {
- h = message.member
- }
- var ment = message.mentions.users.first();
- var getvalueof;
- if(ment) {
- getvalueof = ment;
- } else {
- getvalueof = message.author;
- }
- var mentionned = message.mentions.users.first();
- let mention = message.mentions.users.first() || message.author;
- var client;
- if(mentionned){
- var client = mentionned;
- } else {
- var client = message.author;
- }
- if (!profile[getvalueof.id]) profile[getvalueof.id] = {points: 0,reps: "No Reps", credits: 1, level: 1,tite: "Earth Bot User", rep: 0, lastDaily: "NOT COLLECTED"};
- let Image = Canvas.Image,
- canvas = new Canvas.createCanvas(300, 300),
- ctx = canvas.getContext('2d');
- fs.readFile("Pic.jpg", function (err, Background) { //امتداد الصورة
- if (err) return console.log(err);
- let BG = Canvas.Image;
- let ground = new Image;
- ground.src = Background;
- ctx.drawImage(ground, 0, 0, 300, 300); // حجم الصورة
- })
- let url = getvalueof.displayAvatarURL.endsWith(".webp") ? getvalueof.displayAvatarURL.slice(5, -20) + ".png" : getvalueof.displayAvatarURL;
- jimp.read(url, (err, ava) => {
- if (err) return console.log(err);
- ava.getBuffer(jimp.MIME_PNG, (err, buf) => {
- if (err) return console.log(err);
- //ur name
- ctx.font = 'bold 16px kathen'; // حجم الخط و نوعه
- ctx.fontSize = '40px'; // عرض الخط
- ctx.fillStyle = "#000000"; // لون الخط
- ctx.textAlign = "center"; // محاذا ة النص
- ctx.fillText(`${getvalueof.username}`, 153, 104) // احداثيات اسمك
- //ur name
- ctx.font = 'bold 16px kathen'; // حجم الخط و نوعه
- ctx.fontSize = '40px'; // عرض الخط
- ctx.fillStyle = "#f1f1f1"; // لون الخط
- ctx.textAlign = "center"; // محاذا ة النص
- ctx.fillText(`${getvalueof.username}`, 151, 102) // احداثيات اسمك
- //credit
- ctx.font = "bold 10px kathen" // نوع الخط وحجمه
- ctx.fontSize = '10px'; // عرض الخط
- ctx.fillStyle = "#f1f1f1" // لون الخط
- ctx.textAlign = "center"; // محاذا ة النص
- ctx.fillText(`$${credits[mention.id].credits}`, 230, 182) // احداثيات المصاري
- ctx.font = "bold 14px kathen" // نوع الخط وحجمه
- ctx.fontSize = '12px'; // عرض الخط
- ctx.fillStyle = "#f1f1f1" // لون الخط
- ctx.textAlign = "center"; // محاذا ة النص
- ctx.fillText(`${profile[mention.id].tite}`, 150, 130) // احداثيات المصاري
- //Level
- ctx.font = "bold 24px kathen" // نوع الخط و حجمه
- ctx.fontSize = '10px'; // عرض الخط
- ctx.fillStyle = "#f1f1f1" // لون الخط
- ctx.textAlign = "center"; // محاذا ة النص
- ctx.fillText(`${profile[getvalueof.id].level}`, 70, 78) // احداثيات اللفل
- //info
- ctx.font = "bold 12px kathen" // ن
- ctx.fontSize = '15px'; // عرض الخطوع الخط وحجمه
- ctx.fillStyle = "#000000" // لون الخط
- ctx.textAlign = "center"; // محاذا ة النص
- ctx.fillText(`${profile[getvalueof.id].points}/250`, 150, 232) // احداثيات النقاط
- //info
- ctx.font = "bold 12px kathen" // ن
- ctx.fontSize = '15px'; // عرض الخطوع الخط وحجمه
- ctx.fillStyle = "#f1f1f1" // لون الخط
- ctx.textAlign = "center"; // محاذا ة النص
- ctx.fillText(`${profile[getvalueof.id].points}/250`, 150, 232) // احداثيات النقاط
- // REP
- ctx.font = "bold 20px kathen";
- ctx.fontSize = "50px";
- ctx.fillStyle = "#f1f1f1";
- ctx.textAlign = "center";
- ctx.fillText(`+${profile[mention.id].rep}`, 225, 76)
- let Avatar = Canvas.Image;
- let ava = new Avatar;
- ava.src = buf;
- ctx.beginPath();
- ctx.arc(75, 100, 780, 0, Math.PI*2, true);
- ctx.closePath();
- ctx.clip();
- ctx.drawImage(ava, 110, 29, 82, 60);
- message.channel.startTyping()
- message.channel.sendFile(canvas.toBuffer())
- message.channel.stopTyping()
- })
- })
- }
- });
- client.on('message', message => {
- if (message.content === prefix + "هلا") {
- message.channel.send(`**
- هلا بيك
- **`)
- }
- });
- /*
- client.on('message', async msg => { // eslint-disable-line
- 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];
- const serverQueue = queue.get(msg.guild.id);
- if(msg.content.startsWith(`${PREFIX}play`)){
- const voiceChannel = msg.member.voiceChannel;
- if(!voiceChannel){
- var embedplay1 = new Discord.RichEmbed()
- .setTitle(`Please Connect To A Voice Channel To Play Something!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedplay1);
- }
- const permissions = voiceChannel.permissionsFor(msg.client.user);
- if(!permissions.has('CONNECT')){
- var embedplay2 = new Discord.RichEmbed()
- .setTitle(`I lack the right CONNECT to connect in these Voice Channel!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedplay2);
- }
- if (!permissions.has('SPEAK')){
- var embedplay3 = new Discord.RichEmbed()
- .setTitle(`I do not have the right to SPEAK to connect in these Voice Channel!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedplay3);
- }
- 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);
- await handleVideo(video2, msg, voiceChannel, true);
- }
- var embedplay4 = new Discord.RichEmbed()
- .setTitle(`Playlist: ${playlist.title} queued!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedplay4);
- }else{
- try{
- var video = await youtube.getVideo(url);
- }catch(error){
- try{
- var videos = await youtube.searchVideos(searchString, 10);
- let index = 0;
- var embedqueue5 = new Discord.RichEmbed()
- .setTitle(`Song Play list`)
- .setDescription(`
- ${videos.map(video2 => `${++index}- ${video2.title}`).join('\n')}
- Please enter a number between 1-10 on,a Song select!`)
- .setColor(['#f9fcfc'])
- msg.channel.sendEmbed(embedqueue5);
- try{
- var response = await msg.channel.awaitMessages(msg2 => msg2.content > 0 && msg2.content < 11, {
- maxMatches: 1,
- time: 100000,
- errors: ['time']
- });
- }catch(err){
- console.error(err);
- var embedplay6 = new Discord.RichEmbed()
- .setTitle(`no or invalid number was entered. Demolition of the song selection!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedplay6);
- }
- const videoIndex = parseInt(response.first().content);
- var video = await youtube.getVideoByID(videos[videoIndex - 1].id);
- }catch(err){
- console.error(err);
- var embedplay7 = new Discord.RichEmbed()
- .setTitle(`I could find no video!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedplay7);
- }
- }
- return handleVideo(video, msg, voiceChannel);
- }
- } else if(msg.content.startsWith(`${PREFIX}skip`)) {
- if(!msg.member.voiceChannel){
- var embedskip1 = new Discord.RichEmbed()
- .setTitle(`You are in not in the Voice Channel!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedskip1);
- }
- if(!serverQueue){
- var embedskip2 = new Discord.RichEmbed()
- .setTitle(`There is nothing to Skip!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedskip2);
- }
- serverQueue.connection.dispatcher.end('Skip command has been used!');
- var embedskip3 = new Discord.RichEmbed()
- .setTitle(`⏩Skipped👍`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedskip3);
- }
- else if (msg.content.startsWith(`${PREFIX}stop`)){
- if(!msg.member.voiceChannel){
- var embedstop1 = new Discord.RichEmbed()
- .setTitle(`you're not in the voice channel!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedstop1);
- }
- if(!serverQueue){
- var embedstop2 = new Discord.RichEmbed()
- .setTitle(`There is nothing to stop!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedstop2);
- }
- serverQueue.songs = [];
- serverQueue.connection.dispatcher.end('Stop command has been used!');
- var embedstop3 = new Discord.RichEmbed()
- .setTitle(`⏩Skipped👍`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedstop3);
- }
- else if(msg.content.startsWith(`${PREFIX}song`)){
- if(!serverQueue){
- var embedsong1 = new Discord.RichEmbed()
- .setTitle(`It does nothing at the moment!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedsong1);
- }
- var embedsong2 = new Discord.RichEmbed()
- .setTitle(`${serverQueue.songs[0].title}`)
- .setThumbnail(serverQueue.songs[0].thumbnail)
- .setDescription(`
- Von: ${serverQueue.songs[0].channel}
- Dauer: ${serverQueue.songs[0].duration}
- Link: ${serverQueue.songs[0].url}
- `)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedsong2);
- }
- else if(msg.content.startsWith(`${PREFIX}volume`)){
- if(!serverQueue){
- var embedvolume1 = new Discord.RichEmbed()
- .setTitle(`It does nothing at the moment!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedvolume1);}
- if(!args[1]){
- var embedvolume2 = new Discord.RichEmbed()
- .setTitle(`The current volume is: ${serverQueue.volume}`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedvolume2);
- }
- if(args[1]>0){
- serverQueue.volume = args[1];
- serverQueue.connection.dispatcher.setVolume(args[1] / 2000);
- serverQueue.mute = false;
- var embedvolume3 = new Discord.RichEmbed()
- .setTitle(`The volume is on ${args[1]} set`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedvolume3);
- } else{
- var embedvolume4 = new Discord.RichEmbed()
- .setTitle(`Please enter a number >0 on!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedvolume4);
- }
- }
- else if(msg.content.startsWith(`${PREFIX}queue`)){
- if(!serverQueue){
- var embedqueue1 = new Discord.RichEmbed()
- .setTitle(`It does nothing at the moment!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedqueue1);
- }
- var embedqueue2 = new Discord.RichEmbed()
- .setTitle(`Song Queue`)
- .setDescription(`
- ${serverQueue.songs.map(song => `- ${song.title}`).join('\n')}
- Playing: ${serverQueue.songs[0].title}`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedqueue2);
- }
- else if(msg.content.startsWith(`${PREFIX}pause`)){
- if(serverQueue && serverQueue.playing) {
- serverQueue.playing = false;
- serverQueue.connection.dispatcher.pause();
- var embedpause1 = new Discord.RichEmbed()
- .setTitle(`The song is stopped!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedpause1);
- }
- var embedpause2 = new Discord.RichEmbed()
- .setTitle(`It does nothing at the moment!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedpause2);
- }
- else if(msg.content.startsWith(`${PREFIX}resume`)){
- if(serverQueue && !serverQueue.playing){
- serverQueue.playing = true;
- serverQueue.connection.dispatcher.resume();
- var embedresume1 = new Discord.RichEmbed()
- .setTitle(`The song keeps playing on!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedresume1);
- }
- var embedresume2 = new Discord.RichEmbed()
- .setTitle(`It does nothing at the moment!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedresume2);
- }
- else if(msg.content.startsWith(`${PREFIX}mutebot`)){
- if(!serverQueue){
- var embedmute1 = new Discord.RichEmbed()
- .setTitle(`It does nothing at the moment!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedmute1);
- }
- if(serverQueue.mute){
- var embedmute2 = new Discord.RichEmbed()
- .setTitle(`The music Bot is already muted!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedmute2);
- }
- else{
- serverQueue.mute = true;
- serverQueue.connection.dispatcher.setVolume(0 / 2000);
- var embedmute3 = new Discord.RichEmbed()
- .setTitle(`The music Bot was muted!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedmute3);
- }
- }
- else if(msg.content.startsWith(`${PREFIX}unmutebot`)){
- if(!serverQueue){
- var embedunmute1 = new Discord.RichEmbed()
- .setTitle(`It does nothing at the moment!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedunmute1);
- }
- if(!serverQueue.mute){
- var embedunmute2 = new Discord.RichEmbed()
- .setTitle(`The Music Bot is already unmuted!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedunmute2);
- }
- else{
- serverQueue.mute = false;
- serverQueue.connection.dispatcher.setVolume(serverQueue.volume / 2000);
- var embedunmute3 = new Discord.RichEmbed()
- .setTitle(`The Music Bot has been unmuted!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedunmute3);
- }
- }
- else if(msg.content.startsWith(`${PREFIX}help`)){
- var embedhelp = new Discord.RichEmbed()
- .setTitle(`marcos-MusicBot Commands`)
- .addField("play", "Usage: `play`<song name> Description: To play Music.", false)
- .addField("skip", "Usage: `skip` Description: To skip music.", false)
- .addField("stop", "Usage: `stop` Description: To Bot disconnected.", false)
- .addField("song", "Usage: `song` Description: To Check The Current playing song.", false)
- .addField("queue", "Usage: `queue` Description: To Check The Queue List.", false)
- .addField("volume", "Usage: `volume` Description: To See Volume.", false)
- .addField("pause", "Usage: `pause` Description: To pause The Current Playing Song.", false)
- .addField("resume", "Usage: `resume` Description: To Resume The Paused Song.", false)
- .addField("mutebot", "Usage: `mutebot` Description: To mute Bot.", false)
- .addField("unmutebot", "Usage: `unmutebot` Description: To unmute Bot.", false)
- .setColor(['#f9fcfc'])
- .setThumbnail(client.user.avatarURL)
- return msg.channel.sendEmbed(embedhelp);
- }
- return undefined;
- });
- async function handleVideo(video, msg, voiceChannel, playlist=false){
- const serverQueue = queue.get(msg.guild.id);
- const song = {
- id: video.id,
- title: Util.escapeMarkdown(video.title),
- url: `https://www.youtube.com/watch?v=${video.id}`,
- thumbnail: video.thumbnails.default.url,
- channel: video.channel.title,
- duration: `${video.duration.hours}hrs : ${video.duration.minutes}min : ${video.duration.seconds}sec`
- };
- if(!serverQueue){
- const queueConstruct = {
- textChannel: msg.channel,
- voiceChannel: voiceChannel,
- connection: null,
- songs: [],
- volume: 2100,
- mute: false,
- 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.log(error);
- queue.delete(msg.guild.id);
- var embedfunc1 = new Discord.RichEmbed()
- .setTitle(`Bot could not VoiceChannel the join!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedfunc1);
- }
- } else {
- serverQueue.songs.push(song);
- console.log(serverQueue.songs);
- if(playlist) return undefined;
- else{
- var embedfunc2 = new Discord.RichEmbed()
- .setTitle(`${song.title} queued!`)
- .setColor(['#f9fcfc'])
- return msg.channel.sendEmbed(embedfunc2);
- }
- }
- 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 === 'Stream is not generating quickly enough.') console.log('Song ended');
- else console.log(reason);
- serverQueue.songs.shift();
- setTimeout(() => {
- play(guild, serverQueue.songs[0]);
- }, 250);
- })
- .on('error', error => console.log(error));
- dispatcher.setVolume(serverQueue.volume / 2000);
- var messagefunction1 = new Discord.RichEmbed()
- .setTitle(`Playing 🎶 ${song.title} -now`)
- .setColor(['#f9fcfc'])
- return serverQueue.textChannel.sendEmbed(messagefunction1);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement