From 2fa5a3dcfa2c4d4efe180d1feecbcf431d163a3a Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Sat, 21 Feb 2015 11:36:40 +0100 Subject: [PATCH] First commit --- .gitignore | 4 ++++ LICENSE | 21 +++++++++++++++++++++ certconvert.sh | 3 +++ index.js | 39 +++++++++++++++++++++++++++++++++++++++ package.json | 24 ++++++++++++++++++++++++ 5 files changed, 91 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100755 certconvert.sh create mode 100644 index.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..33a4a5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +*sublime* +mumblemusicbot +*.pem diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..242132d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/certconvert.sh b/certconvert.sh new file mode 100755 index 0000000..7c476a2 --- /dev/null +++ b/certconvert.sh @@ -0,0 +1,3 @@ + +openssl pkcs12 -in *.p12 -out public.pem -clcerts -nokeys +openssl pkcs12 -in *.p12 -out private.pem -nocerts -nodes diff --git a/index.js b/index.js new file mode 100644 index 0000000..b272593 --- /dev/null +++ b/index.js @@ -0,0 +1,39 @@ +//Mumsix, mumble music bot +var mumble = require('mumble'); +var GS = require('grooveshark-streaming'); +var fs = require('fs'); + +var options = { + key : fs.readFileSync(__dirname + '/private.pem'), + cert : fs.readFileSync(__dirname + '/public.pem') +} + +console.log('Connecting'); +mumble.connect('mumble://wallpiece:9648', options, function (err, res) { + if (err) throw new Error(err); + + res.authenticate('MusicBot', 'yolo'); + + res.on('initialized', function () { + console.log('Connected!'); + }); + + // On text message... + res.on( 'textMessage', function (data) { + if (data.message.split(' ')[0] == '/m' || data.message.split(' ')[0] == '/music') { + var command = data.message.split(' ').splice(1); + if (command[0] == 'g' || command[0] == 'grooveshark') { + grooveshark(command); + } + } + }); + + // res.on( 'voice', function (event) { + // console.log( 'Mixed voice' ); + // var pcmData = event.data; + // }); +}); + +function grooveshark() { + +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8fda1a5 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "mumblemusicbot", + "version": "0.0.1", + "description": "The bot to lighten that mumble channel up!", + "main": "index.js", + "dependencies": { + "grooveshark-streaming": "0.0.8", + "mumble": "0.0.2" + }, + "devDependencies": {}, + "scripts": { + "test": "node index test" + }, + "keywords": [ + "mumble", + "music", + "bot", + "lounge", + "relax", + "listening" + ], + "author": "Bram van der Veen", + "license": "MIT" +}