Skip to content

Commit 2d4cfc7

Browse files
SudhanPlayzColonel-LtdJosephReyansh-Khobragade
committed
Discord Music Bot v4 - Inital Launch
Co-Authored-By: ColonelOU <[email protected]> Co-Authored-By: Joseph <[email protected]> Co-Authored-By: Reyansh-Khobragade <[email protected]>
1 parent 7f330fd commit 2d4cfc7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4223
-1096
lines changed

.env

-3
This file was deleted.

.github/FUNDING.yml

-3
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.md

-38
This file was deleted.

.github/ISSUE_TEMPLATE/feature_request.md

-20
This file was deleted.

.gitignore

+106-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,109 @@
1-
# Packages
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
241
node_modules/
3-
package-lock.json
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
470
yarn.lock
571

6-
# Envronmental Storage
7-
.env
72+
# dotenv environment variables file
73+
.env
74+
.env.test
75+
76+
# parcel-bundler cache (https://parceljs.org/)
77+
.cache
78+
79+
# Next.js build output
80+
.next
81+
82+
# Nuxt.js build / generate output
83+
.nuxt
84+
dist
85+
86+
# Gatsby files
87+
.cache/
88+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
89+
# https://nextjs.org/blog/next-9-1#public-directory-support
90+
# public
91+
92+
# vuepress build output
93+
.vuepress/dist
94+
95+
# Serverless directories
96+
.serverless/
97+
98+
# FuseBox cache
99+
.fusebox/
100+
101+
# DynamoDB Local files
102+
.dynamodb/
103+
104+
# TernJS port file
105+
.tern-port
106+
107+
# Etc
108+
dev-config.js
109+
a.js

.replit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
run = "node index.js"
2-
language = "NodeJS"
2+
language = "NodeJS"

CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht
7373
[homepage]: https://www.contributor-covenant.org
7474

7575
For answers to common questions about this code of conduct, see
76-
https://www.contributor-covenant.org/faq
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
8989
available at [http://contributor-covenant.org/version/1/4][version]
9090

9191
[homepage]: http://contributor-covenant.org
92-
[version]: http://contributor-covenant.org/version/1/4/
92+
[version]: http://contributor-covenant.org/version/1/4/

LICENSE.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# License for Discord-MusicBot
1+
<h1 align="center">License for Discord-MusicBot</h1>
22

33
* The credits should not be changed.
4-
* The bot-code should be used for **private hosting** and **personal usage** only.
5-
* Using the code for public usage is **not allowed**.
6-
7-
> **Note:** if you are found to be violating any of the above stated rule you might be asked to takedown your bot, happy listening!! Incase of any doubts in the license contact owner.
4+
* You can make your bot public ![EpicYay](https://cdn.discordapp.com/emojis/825211636171800596.gif?v=1&size=32)
5+
* Don't republish like uploading a yt vid like im doing...
6+
* Don't create your own repo, If you wanted to add my codes then just fork
7+
* (Optional) Make sure to [subscribe](https://youtube.com/CodingWithSudhan) :)

Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
worker: node index.js
1+
worker: node index.js

README.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
1-
<h1 align="center"><img src="./assets/Music.gif" width="30px"> Advanced Discord Music Bot <img src="./assets/Music.gif" width="30px"></h1>
2-
<p align="center">Thanks for 4k Views! I made this for you all!</p>
3-
<div align="center"><img src="./assets/banner.gif"></div>
4-
5-
## 📝 Latest Announcement
6-
Discord-MusicBot v4 will be launched shortly :tada: You can able to check out the [project](https://github.com/SudhanPlayz/Discord-MusicBot/projects/1) and its [discussion](https://github.com/SudhanPlayz/Discord-MusicBot/discussions/72)
1+
<h1 align="center"><img src="./assets/logo.gif" width="30px"> Discord Music Bot <img src="./assets/logo.gif" width="30px"></h1>
2+
<p align="center">Thanks for 25k Views with 500 subs!</p>
73

84
## 📝 Tutorial
5+
Soon
6+
<!--
97
Tutorial has been uploaded on YouTube <img src="https://www.youtube.com/about/static/svgs/icons/brand-resources/YouTube_icon_full-color.svg?cache=f2ec7a5" width="30px"> Watch it by clicking [here](https://youtu.be/DQXuTaYa31I)
8+
-->
109

1110
## 📝 [Support Server](https://discord.gg/a9SHDpD)
1211
Got any error or any problem with the code? Join this server and ask your question instead of creating issues unless its a code bug. https://discord.gg/a9SHDpD
1312

1413
## 📸 Screenshots
1514

16-
<div align="left"><img src="https://pika-pika.is-inside.me/zJduq9Gn.png"></div><div align="center"><img src="https://pika-pika.is-inside.me/9ufBoGDH.png"></div><div align="right"><img src="https://pika-pika.is-inside.me/8QkGROJv.png"></div>
15+
<div align="left"><img src="/assets/Screenshot_1.png"></div><div align="center"><img src="/assets/Screenshot_2.png"></div><div align="right"><img src="/assets/Screenshot_3.png"></div>
16+
17+
<div align="center"><img src="/assets/Features.png"></div>
1718

1819
## 💨 Run the projects
1920
Glitch: [![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/import/github/SudhanPlayz/Discord-MusicBot)
2021
Repl: [![Run on Repl.it](https://repl.it/badge/github/SudhanPlayz/Discord-MusicBot)](https://repl.it/github/SudhanPlayz/Discord-MusicBot)
2122
Heroku: [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/SudhanPlayz/Discord-MusicBot)
23+
2224
## ✨ Contributors
23-
Contributions are always welcomed :D
25+
Contributions are always welcomed :D Make sure to follow [Contributing.md](/CONTRIBUTING.md)
26+
2427
<a href="https://github.com/SudhanPlayz/Discord-MusicBot/graphs/contributors">
2528
<img src="https://contributors-img.web.app/image?repo=SudhanPlayz/Discord-MusicBot" />
2629
</a>

_config.yml

-1
This file was deleted.

api/Middlewares/Auth.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
let config;
2+
try {
3+
//Config for testing
4+
config = require("../../dev-config");
5+
} catch {
6+
//Config for production
7+
config = require("../../config");
8+
}
9+
10+
const Auth = (req, res, next) => {
11+
if(!req.user)return res.redirect(config.CallbackURL)
12+
else next()
13+
}
14+
15+
module.exports = Auth

api/Routes/user.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { Permissions } = require("discord.js")
2+
const client = require("../../")
3+
const api = require("express").Router()
4+
5+
api.get("/", async (req, res) => {
6+
if(!req.user)return res.send({})
7+
req.user.guilds.map(g => {
8+
g.hasPerms = new Permissions(g.permissions).has("MANAGE_GUILD", true)
9+
g.inGuild = client.guilds.cache.has(g.id)
10+
return g
11+
})
12+
res.send({ user: req.user })
13+
})
14+
15+
module.exports = api

api/index.js

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const { static, Router } = require("express")
2+
const api = Router();
3+
const fs = require("fs");
4+
const { join } = require("path");
5+
6+
const RoutesPath = join(__dirname, "Routes");
7+
8+
fs.readdir(RoutesPath, (err, files) => {
9+
if (err) return console.log(err);
10+
files.forEach((file) => {
11+
api.use("/api/" + file.split(".")[0], require(RoutesPath + "/" + file));
12+
}
13+
);
14+
});
15+
16+
api.use("/", static(join(__dirname, "..", "assets")))
17+
18+
//Handle Login and other stuff
19+
20+
const session = require("express-session")
21+
const DiscordStrategy = require("passport-discord").Strategy;
22+
const passport = require("passport")
23+
24+
let config;
25+
try {
26+
//Config for testing
27+
config = require("../dev-config");
28+
} catch {
29+
//Config for production
30+
config = require("../config");
31+
}
32+
33+
passport.use(new DiscordStrategy({
34+
clientID: config.ClientID,
35+
clientSecret: config.ClientSecret,
36+
callbackURL: config.CallbackURL,
37+
scope: config.Scopes.join(" ")
38+
}, function(accessToken, refreshToken, profile, done){
39+
//User logged in yay!
40+
process.nextTick(function() {
41+
return done(null, profile);
42+
});
43+
}));
44+
45+
api.use(session({
46+
secret: config.CookieSecret,
47+
resave: false,
48+
saveUninitialized: false
49+
}));
50+
51+
api.use(passport.initialize());
52+
api.use(passport.session());
53+
54+
api.get(config.CallbackURL, passport.authenticate('discord', {
55+
failureRedirect: '/'
56+
}), function(req, res) {
57+
res.redirect('/dashboard')
58+
});
59+
60+
passport.serializeUser(function(user, done) {
61+
done(null, user);
62+
});
63+
64+
passport.deserializeUser(function(obj, done) {
65+
done(null, obj);
66+
});
67+
68+
api.use("/", require("./routes"))
69+
70+
module.exports = api;

0 commit comments

Comments
 (0)