forked from SudhanPlayz/Discord-MusicBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
7f330fd
commit 2d4cfc7
Showing
68 changed files
with
4,223 additions
and
1,096 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,109 @@ | ||
# Packages | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
package-lock.json | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
yarn.lock | ||
|
||
# Envronmental Storage | ||
.env | ||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Etc | ||
dev-config.js | ||
a.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
run = "node index.js" | ||
language = "NodeJS" | ||
language = "NodeJS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# License for Discord-MusicBot | ||
<h1 align="center">License for Discord-MusicBot</h1> | ||
|
||
* The credits should not be changed. | ||
* The bot-code should be used for **private hosting** and **personal usage** only. | ||
* Using the code for public usage is **not allowed**. | ||
|
||
> **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. | ||
* You can make your bot public ![EpicYay](https://cdn.discordapp.com/emojis/825211636171800596.gif?v=1&size=32) | ||
* Don't republish like uploading a yt vid like im doing... | ||
* Don't create your own repo, If you wanted to add my codes then just fork | ||
* (Optional) Make sure to [subscribe](https://youtube.com/CodingWithSudhan) :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
worker: node index.js | ||
worker: node index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let config; | ||
try { | ||
//Config for testing | ||
config = require("../../dev-config"); | ||
} catch { | ||
//Config for production | ||
config = require("../../config"); | ||
} | ||
|
||
const Auth = (req, res, next) => { | ||
if(!req.user)return res.redirect(config.CallbackURL) | ||
else next() | ||
} | ||
|
||
module.exports = Auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { Permissions } = require("discord.js") | ||
const client = require("../../") | ||
const api = require("express").Router() | ||
|
||
api.get("/", async (req, res) => { | ||
if(!req.user)return res.send({}) | ||
req.user.guilds.map(g => { | ||
g.hasPerms = new Permissions(g.permissions).has("MANAGE_GUILD", true) | ||
g.inGuild = client.guilds.cache.has(g.id) | ||
return g | ||
}) | ||
res.send({ user: req.user }) | ||
}) | ||
|
||
module.exports = api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const { static, Router } = require("express") | ||
const api = Router(); | ||
const fs = require("fs"); | ||
const { join } = require("path"); | ||
|
||
const RoutesPath = join(__dirname, "Routes"); | ||
|
||
fs.readdir(RoutesPath, (err, files) => { | ||
if (err) return console.log(err); | ||
files.forEach((file) => { | ||
api.use("/api/" + file.split(".")[0], require(RoutesPath + "/" + file)); | ||
} | ||
); | ||
}); | ||
|
||
api.use("/", static(join(__dirname, "..", "assets"))) | ||
|
||
//Handle Login and other stuff | ||
|
||
const session = require("express-session") | ||
const DiscordStrategy = require("passport-discord").Strategy; | ||
const passport = require("passport") | ||
|
||
let config; | ||
try { | ||
//Config for testing | ||
config = require("../dev-config"); | ||
} catch { | ||
//Config for production | ||
config = require("../config"); | ||
} | ||
|
||
passport.use(new DiscordStrategy({ | ||
clientID: config.ClientID, | ||
clientSecret: config.ClientSecret, | ||
callbackURL: config.CallbackURL, | ||
scope: config.Scopes.join(" ") | ||
}, function(accessToken, refreshToken, profile, done){ | ||
//User logged in yay! | ||
process.nextTick(function() { | ||
return done(null, profile); | ||
}); | ||
})); | ||
|
||
api.use(session({ | ||
secret: config.CookieSecret, | ||
resave: false, | ||
saveUninitialized: false | ||
})); | ||
|
||
api.use(passport.initialize()); | ||
api.use(passport.session()); | ||
|
||
api.get(config.CallbackURL, passport.authenticate('discord', { | ||
failureRedirect: '/' | ||
}), function(req, res) { | ||
res.redirect('/dashboard') | ||
}); | ||
|
||
passport.serializeUser(function(user, done) { | ||
done(null, user); | ||
}); | ||
|
||
passport.deserializeUser(function(obj, done) { | ||
done(null, obj); | ||
}); | ||
|
||
api.use("/", require("./routes")) | ||
|
||
module.exports = api; |
Oops, something went wrong.