Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a21c556
YouTube search list
Colonel-Ltd Nov 23, 2020
7737851
Update package.json
Colonel-Ltd Nov 23, 2020
bb9e1cd
Added pages queue list
Colonel-Ltd Nov 24, 2020
0435903
Support loop command
Colonel-Ltd Nov 24, 2020
2fcb0b6
Added loop command
Colonel-Ltd Nov 24, 2020
d172d89
Added playlist command by name or link
Colonel-Ltd Nov 24, 2020
ae19c73
Update play.js
Colonel-Ltd Nov 25, 2020
8eb793a
Added youtube url play
Colonel-Ltd Nov 25, 2020
18495de
rename file
Colonel-Ltd Nov 25, 2020
cc10b50
Update search.js
Colonel-Ltd Nov 25, 2020
34c6cd2
Fix bugs
Colonel-Ltd Nov 25, 2020
3649205
Fix bugs
Colonel-Ltd Nov 25, 2020
b69026b
Fix bug
Colonel-Ltd Nov 25, 2020
87f71dc
Fix bug
Colonel-Ltd Nov 25, 2020
2aefada
Fix bug
Colonel-Ltd Nov 25, 2020
f697224
Fix bugs
Colonel-Ltd Nov 25, 2020
ebe5172
Fix big
Colonel-Ltd Nov 25, 2020
692d375
Update package.json
Colonel-Ltd Nov 25, 2020
f6204a5
Command stop with leave
Colonel-Ltd Nov 25, 2020
4fdaffb
Update play.js
Colonel-Ltd Nov 25, 2020
804b2f5
Update search.js
Colonel-Ltd Nov 25, 2020
5ad1d7c
Merge branch 'master' into master
Colonel-Ltd Nov 25, 2020
5479375
Fix bug skip with stop while resumed
Colonel-Ltd Nov 25, 2020
4d1589f
Added loop
Colonel-Ltd Nov 25, 2020
d442b6a
Added lyrics command
Colonel-Ltd Nov 25, 2020
93a0b48
Added lyrics-finder package
Colonel-Ltd Nov 25, 2020
162a41c
Updated
Colonel-Ltd Nov 25, 2020
7d6e3ec
Added 24/7
Colonel-Ltd Nov 26, 2020
efda447
Fixed
Colonel-Ltd Nov 26, 2020
7113924
Added 24/7
Colonel-Ltd Nov 26, 2020
e03e4c9
fix bugs
Colonel-Ltd Nov 26, 2020
e09aa14
fix bugs
Colonel-Ltd Nov 26, 2020
33b259b
Percentage volume
Colonel-Ltd Nov 26, 2020
6dd03e9
Added 24/7
Colonel-Ltd Nov 26, 2020
2654b94
Added 24/7
Colonel-Ltd Nov 26, 2020
d0a6454
Update package.json
Colonel-Ltd Nov 26, 2020
09ace70
Merge branch 'master' into master
Colonel-Ltd Nov 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added 24/7
  • Loading branch information
Colonel-Ltd authored Nov 26, 2020
commit 71139247b4b0696372a92fc583817c3b0ebec543
23 changes: 15 additions & 8 deletions commands/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { Util, MessageEmbed } = require("discord.js");
const ytdl = require("ytdl-core");
const ytdlDiscord = require("ytdl-core-discord");
const yts = require("yt-search");
const fs = require('fs');
const sendError = require("../util/error")

module.exports = {
Expand All @@ -13,7 +14,7 @@ module.exports = {
},

run: async function (client, message, args) {
const channel = message.member.voice.channel;
let channel = message.member.voice.channel;
if (!channel)return sendError("I'm sorry but you need to be in a voice channel to play music!", message.channel);

const permissions = channel.permissionsFor(message.client.user);
Expand Down Expand Up @@ -87,7 +88,7 @@ module.exports = {
voiceChannel: channel,
connection: null,
songs: [],
volume: 2,
volume: 80,
playing: true,
loop: false
};
Expand All @@ -96,13 +97,19 @@ module.exports = {

const play = async (song) => {
const queue = message.client.queue.get(message.guild.id);
if (!song) {
sendError("Leaving the voice channel because I think there are no songs in the queue. If you like the bot stay 24/7 in voice channel go to `commands/play.js` and remove the line number 61\n\nThank you for using my code! [GitHub](https://github.com/SudhanPlayz/Discord-MusicBot)", message.channel)
if(!queue) return;
queue.voiceChannel.leave();//If you want your bot stay in vc 24/7 remove this line :D
let prefix = JSON.parse(fs.readFileSync("./online.json", "utf8"));
if (!prefix[message.guild.id]) prefix[message.guild.id] = {
prefix: false,
};
var online = prefix[message.guild.id]
if (!song){
if (!online.prefix) {
sendError("Leaving the voice channel because I think there are no songs in the queue. If you like the bot stay 24/7 in voice channel run `!afk`\n\nThank you for using my code! [GitHub](https://github.com/SudhanPlayz/Discord-MusicBot)", message.channel)
message.guild.me.voice.channel.leave();//If you want your bot stay in vc 24/7 remove this line :D
message.client.queue.delete(message.guild.id);
return;
}
return message.client.queue.delete(message.guild.id);
}
let stream = null;
let streamType = song.url.includes("youtube.com") ? "opus" : "ogg/opus";

Expand All @@ -129,7 +136,7 @@ if (queue) {
play(queue.songs[0]);
})
.on("error", (error) => console.error(error));
dispatcher.setVolumeLogarithmic(queue.volume / 5);
dispatcher.setVolumeLogarithmic(queue.volume / 100);
let thing = new MessageEmbed()
.setAuthor("Started Playing Music!", "https://raw.githubusercontent.com/SudhanPlayz/Discord-MusicBot/master/assets/Music.gif")
.setThumbnail(song.img)
Expand Down