Giter VIP home page Giter VIP logo

ohgodmusicbot's Introduction

OhGodMusicBot

A v10 Discord.JS music bot in 100 lines or less

Installation (Windows)

This section is for running the bot locally on Windows. If you're on Mac it should be similar. I'll assume Linux users can figure it out.

Download Node.js

Node.js is what will be used to run the bot. Download Node.js 6.X from the website.

Install Node.js

Open the Node.js Setup. In the options, make sure Node.js runtime npm package manager and Add to PATH are enabled. After that install Node.js.

Install Windows-Build-Tools

Open up a windows powershell and run npm i -g windows-build-tools. This will take a while as it will download and install both python 2.7 and c++ build tools, so you can run node-gyp builds.

Download Git

And install it. The website is http://git-scm.com and make sure you choose "for command prompt".

Download FFMPEG

Download FFMPEG from this website. Make sure to find the current Static Build for your OS Architecture (32bit/64bit).

Install & Configure FFMPEG

Extract the files to the root of your harddrive, and rename the folder to ffmpeg.

Then add FFMPEG to your Path variable:

  1. windows key + x
  2. go to system
  3. on the left Advanced system settings
  4. Environment Variables
  5. under System variables find the variable Path hit edit
  • Depending on your version of windows you may have a list of entries or a semicolon sperated field of entries.

If Windows 10:

  1. Hit the new button on the right
  2. add c:\ffmpeg\bin

If older versions of Windows:

  1. add ;c:\ffmpeg\bin to the end of the field.

Download and Install OhGodMusicBot

Next you'll need to download the bot and configure it. Download the master branch and put the unzipped files in a new folder on your computer. Next rename .json.example to .json and enter the correct information. Note: You will have to remove any and all comments from the .json.example file, as they are not supported in json. They are there to guide you as you decide how you want to configure your bot

For obtaining a Discord Bot token, please see this page.

Before running the bot you need to install the dependencies. In the folder you put the files in, Shift+Right click and select open command window here. In the command prompt type npm install.

The bot should now be ready! Open a command prompt like above and type npm start to start the bot and see if it works.

Install dependencies

Windows

Shift-RightClick in the folder that you downloaded and select Open command window here. Then type npm install and hit Enter.

Linux

cd to where you cloned the GitHub repo and type npm install. This will take a while.

ohgodmusicbot's People

Contributors

appellation avatar bdistin avatar gavwin avatar jupjohn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ohgodmusicbot's Issues

Cannot start the bot...

Hey, I got the bot today and I tried to start it after installing the dependencies, but I got this error when starting server.js.

module.js:544
throw err;
^Error: Cannot find module 'pako'


Could someone tell me how to correct it?

Thanks,
FHGDev

Bot Dont Open

module.js:684
throw err;
^

SyntaxError: C:\Users\MyPC\Desktop\OhGodMusicBot-master\tokens.json: Unexpected
token / in JSON at position 150
at JSON.parse ()
at Object.Module._extensions..json (module.js:681:27)
at Module.load (module.js:575:32)
at tryModuleLoad (module.js:515:12)
at Function.Module._load (module.js:507:3)
at Module.require (module.js:606:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\MyPC\Desktop\OhGodMusicBot-master\server.js:
3:16)
at Module._compile (module.js:662:30)
at Object.Module._extensions..js (module.js:673:10)

Playlists

You should the music bot play playlists, It would be really useful

Vote To Skip?

Is there anyway I can edit the !skip command so that depending on how many people are in the voice channel with the bot they all have to !skip inorder for the song to skip?

Suggestion.

How about making the play command to join the channel and queue the song at the same time.

Bot doesn't play songs

I used the song Bloom by Troye Sivan for example, don't question it!

Console log:

(node:33536) DeprecationWarning: TextChannel#sendMessage: use TextChannel#send instead { '444472391087816708': { playing: true, songs: [ [Object] ] } } { url: 'https://www.youtube.com/watch?v=rxmtHVSVjdo', title: 'Troye Sivan - Bloom (Lyric Video)', requester: 'Samcool236 ๐Ÿ‡ฆ๐Ÿ‡บ' } undefined { '444472391087816708': { playing: true, songs: [] } } undefined { '444472391087816708': { playing: true, songs: [ [Object], [Object], [Object] ] } } { url: 'https://www.youtube.com/watch?v=rxmtHVSVjdo', title: 'Troye Sivan - Bloom (Lyric Video)', requester: 'Samcool236 ๐Ÿ‡ฆ๐Ÿ‡บ' } { url: 'https://www.youtube.com/watch?v=rxmtHVSVjdo', title: 'Troye Sivan - Bloom (Lyric Video)', requester: 'Samcool236 ๐Ÿ‡ฆ๐Ÿ‡บ' } { url: 'https://www.youtube.com/watch?v=rxmtHVSVjdo', title: 'Troye Sivan - Bloom (Lyric Video)', requester: 'Samcool236 ๐Ÿ‡ฆ๐Ÿ‡บ' } undefined

I added the same song 3 times in the queue, the bot joins the voice channel, fine. However, it doesn't play the songs, it just auto skips all of the songs till the queue is empty.

Edit: I tried making another music bot from scratch using another node module, and it does the same thing. Is the issue on my end?

FFMPEG error

I am hosting this bot and when I do npm start, it gives me this error if I use the ++play command on discord. Can someone please help?
PS C:\Users\Alex\Downloads\OhGodMusicBot-master> node server
ready!
C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\pcm\FfmpegConverterEngine.js:80
throw new Error(
^

Error: FFMPEG was not found on your system, so audio cannot be played. Please make sure FFMPEG is installed and in your PATH.
at chooseCommand (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\pcm\FfmpegConverterEngine.js:80:9)
at new FfmpegConverterEngine (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\pcm\FfmpegConverterEngine.js:45:20)
at new AudioPlayer (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\player\AudioPlayer.js:19:23)
at new VoiceConnection (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\VoiceConnection.js:58:19)
at PendingVoiceConnection.upgrade (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:241:12)
at PendingVoiceConnection.pass (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:220:28)
at PendingVoiceConnection.checkReady (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:151:12)
at PendingVoiceConnection.setTokenAndEndpoint (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:192:10)
at ClientVoiceManager.onVoiceServer (C:\Users\Alex\Downloads\OhGodMusicBot-master\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:36:74)
at emitOne (events.js:116:13)

Suggestion for search

I have an idea.
What about an search function?
Just an function that searches with youtube api.
The users has to provide his own api key in the tokens.json

DepercationWarning

DeprecationWarning: MessageCollector will soon no longer emit "message", use "collect" instead

bot disconects after playing a song

So i am running the bot and after a song it wait a little and suddenly disconnect from discord.

the install gave me some warnings but the bot dose work
PS C:\bot> npm install
npm WARN [email protected] requires a peer of erlpack@hammerandchisel/erlpack#master but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of opusscript@^0.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of uws@^0.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.

audited 53 packages in 3.401s
found 0 vulnerabilities

on the bots screen it will sai Undefined as its last action

Error: No video id found

I'm using your script for a music feature on my bot and when you use the add command and put text that isn't a video id / url, it crashes the bot with the error Error: No video id found

First song in queue playing twice

Heya,

So I'm not quite sure why but it seems that the first song I put in the queue will always play twice, even if the queue indicates it is present only once. Is there a setting I'm not toggling somewhere or is this actually an issue.

Unrelated, I'm also surprised there isn't a leave command. Could you not include something along the lines of: 'leave': (msg) => { msg.guild.member(client.user).voiceChannel.leave(); },? It seems to work fine and still keeps the code under 100 lines if that's important.

Crashes when using dm

If you use the?add or any other comand than help bot will crash. And will not work until restart.

cant install ytdl-core

cant install ytdl-core

C:\Users\zz\bot\music>npm install ytdl-core
npm ERR! code ENOGIT
npm ERR! Error while executing:
npm ERR! undefined ls-remote -h -t ssh://[email protected]/fent/node-ytdl-core.git
npm ERR!
npm ERR! undefined
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\zz\AppData\Roaming\npm-cache_logs\2018-08-20T14_08_18_577Z-debug.log

heroku error

whenever i add the bot to heroku i get the following error

Error: Cannot Find Module ./tokens.json

But the thing is the file it cant find is in the directory so it should work
anyone know a solution?

Skipping 2 songs

collector.on('message', m => {
if (m.content.startsWith(tokens.prefix + 'skip')){
if (m.member.hasPermission ('ADMINISTRATOR')) {
msg.channel.sendMessage('Skipped').then(() => {dispatcher.end();});
}
}
});

image

Quick Question

I'm trying to set up a music bot deployer for a large discord guild. My shard manager will be running 20 or so of these bots at max capacity, if required. Just a quick question, what's the average ram usage per instance on Linux (debian)? Your bot seems the best bet as it's the simplest and most concise of the music bots I've found

Windows Powershell error

npm : events.js:160
At line:1 char:1
+ npm i -g windows-build-tools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (events.js:160:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
      throw er; // Unhandled 'error' event
      ^
Error: spawn powershell.exe ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
    at onErrorNT (internal/child_process.js:376:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
npm
 
ERR!
 Windows_NT 10.0.15063
npm
 
ERR!
 
argv
 "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "-g" 
"windows-build-tools"
npm
 
ERR!
 
node
 v6.11.4
npm
 
ERR!
 
npm 
 v3.10.10
npm
 
ERR!
 
code
 ELIFECYCLE
npm
 
ERR!
 [email protected] postinstall: `node ./lib/index.js`
npm
 
ERR!
 Exit status 1
npm
 
ERR!
 
npm
 
ERR!
 Failed at the [email protected] postinstall script 'node ./lib/index.js'.
npm
 
ERR!
 Make sure you have the latest version of node.js and npm installed.
npm
 
ERR!
 If you do, this is most likely a problem with the windows-build-tools package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./lib/index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs windows-build-tools
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls windows-build-tools
npm ERR! There is likely additional logging output above.
npm
 
ERR!
 Please include the following file with any support request:
npm
 
ERR!
     C:\WINDOWS\system32\npm-debug.log

How do I fix this?!?!

Running Bot On PI

Hi all, Just wondering if anyone has manages to get the bot running on a raspberry pi yet and if so, How?

Missing Permissions

It gives me the error when I used /play command. any idea? I don't even create any roles/assign to my bot, my bot should have a permissions lol

DiscordAPIError: Missing Permissions
    at item.request.gen.end (/home/gangwar/node_modules/discord.js/src/rest/handlers/RequestHandler.js:52:65)
    at then (/home/gangwar/node_modules/snekfetch/src/index.js:257:21)
    at propagateAslWrapper (/usr/lib/node_modules/pm2/node_modules/async-listener/index.js:457:23)
    at /usr/lib/node_modules/pm2/node_modules/async-listener/index.js:494:70
    at <anonymous>
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:228:7)
Uncaught Promise Error: 
DiscordAPIError: Missing Permissions
    at item.request.gen.end (/home/gangwar/node_modules/discord.js/src/rest/handlers/RequestHandler.js:52:65)
    at then (/home/gangwar/node_modules/snekfetch/src/index.js:257:21)
    at propagateAslWrapper (/usr/lib/node_modules/pm2/node_modules/async-listener/index.js:457:23)
    at /usr/lib/node_modules/pm2/node_modules/async-listener/index.js:494:70
    at <anonymous>
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:228:7)
Uncaught Promise Error: 
DiscordAPIError: Missing Permissions
    at item.request.gen.end (/home/gangwar/node_modules/discord.js/src/rest/handlers/RequestHandler.js:52:65)
    at then (/home/gangwar/node_modules/snekfetch/src/index.js:257:21)
    at propagateAslWrapper (/usr/lib/node_modules/pm2/node_modules/async-listener/index.js:457:23)
    at /usr/lib/node_modules/pm2/node_modules/async-listener/index.js:494:70
    at <anonymous>
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:228:7)```

Commands don't works

It's all codes ok, without errors. When i start the bot this start normally but all commands doesn't work, all commands don't work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.