Skip to content

Commit

Permalink
Discord Music Bot v4 - Inital Launch
Browse files Browse the repository at this point in the history
Co-Authored-By: ColonelOU <[email protected]>
Co-Authored-By: Joseph <[email protected]>
Co-Authored-By: Reyansh-Khobragade <[email protected]>
  • Loading branch information
4 people committed May 2, 2021
1 parent 7f330fd commit 2d4cfc7
Show file tree
Hide file tree
Showing 68 changed files with 4,223 additions and 1,096 deletions.
3 changes: 0 additions & 3 deletions .env

This file was deleted.

3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

110 changes: 106 additions & 4 deletions .gitignore
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
2 changes: 1 addition & 1 deletion .replit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
run = "node index.js"
language = "NodeJS"
language = "NodeJS"
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht
[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
https://www.contributor-covenant.org/faq
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[version]: http://contributor-covenant.org/version/1/4/
10 changes: 5 additions & 5 deletions LICENSE.md
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) :)
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker: node index.js
worker: node index.js
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<h1 align="center"><img src="./assets/Music.gif" width="30px"> Advanced Discord Music Bot <img src="./assets/Music.gif" width="30px"></h1>
<p align="center">Thanks for 4k Views! I made this for you all!</p>
<div align="center"><img src="./assets/banner.gif"></div>

## 📝 Latest Announcement
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)
<h1 align="center"><img src="./assets/logo.gif" width="30px"> Discord Music Bot <img src="./assets/logo.gif" width="30px"></h1>
<p align="center">Thanks for 25k Views with 500 subs!</p>

## 📝 Tutorial
Soon
<!--
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)
-->

## 📝 [Support Server](https://discord.gg/a9SHDpD)
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

## 📸 Screenshots

<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>
<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>

<div align="center"><img src="/assets/Features.png"></div>

## 💨 Run the projects
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)
Repl: [![Run on Repl.it](https://repl.it/badge/github/SudhanPlayz/Discord-MusicBot)](https://repl.it/github/SudhanPlayz/Discord-MusicBot)
Heroku: [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/SudhanPlayz/Discord-MusicBot)

## ✨ Contributors
Contributions are always welcomed :D
Contributions are always welcomed :D Make sure to follow [Contributing.md](/CONTRIBUTING.md)

<a href="https://github.com/SudhanPlayz/Discord-MusicBot/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=SudhanPlayz/Discord-MusicBot" />
</a>
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

15 changes: 15 additions & 0 deletions api/Middlewares/Auth.js
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
15 changes: 15 additions & 0 deletions api/Routes/user.js
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
70 changes: 70 additions & 0 deletions api/index.js
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;
Loading

0 comments on commit 2d4cfc7

Please sign in to comment.