Browse Source

readme and command fixes

master
calexil 1 year ago
parent
commit
945e3bf6ed
3 changed files with 4 additions and 79 deletions
  1. 3
    0
      Commands.md
  2. 1
    1
      README.md
  3. 0
    78
      bot.js~

+ 3
- 0
Commands.md View File

@@ -6,6 +6,9 @@ I say: *It worked!*
You say: **best girl, best girl? best grill, best grill?, etc.**
I say: *Big Band.*

You say: **best booty**
I say: *Squigly, Duh.*

You say: **!help**
I say: *Hello there, I'm a dumb bot written by [@calexil#9270](https://github.com/calexil) and [@Timberius#8180](https://github.com/TimboKZ) , you can see my commands here: https://github.com/calexil/BansheeBot/blob/master/Commands.md*


+ 1
- 1
README.md View File

@@ -10,7 +10,7 @@ A simple bot that reads the song info from the currently playing track in Banshe
* 2: Make a new app with the [discord developer dashboard](https://discordapp.com/developers/applications/me) and note your client secret.
* 3: Link your free heroku account to github and deploy your fork or clone, be sure to set your config vars with an item KEY of BOT_TOKEN and a value of the aformentioned client secret from your discord bot app.
* 4: Edit the file [bot.js at line 43](https://github.com/calexil/BansheeBot/blob/master/bot.js#L43) to match your music channels Id, then [edit the file at line 60](https://github.com/calexil/BansheeBot/blob/master/bot.js#L60) so it matches your heroku app page.
* 5: Start Banshee, Play music and then run the [bansheecheck.sh script](https://github.com/calexil/BansheeBot/blob/master/bansheecheck.sh), be sure to edit it to match your username and heroku app page endpoint
* 5: Start Banshee or Rhythmbox, Play music and then run the [bansheecheck.sh script](https://github.com/calexil/BansheeBot/blob/master/bansheecheck.sh) or the [rhythmboxcheck.sh script](https://github.com/calexil/BansheeBot/blob/master/rhythmboxcheck.sh), be sure to edit it to match your username and heroku app page endpoint
* 6: Check out the [Command list here](https://github.com/calexil/BansheeBot/blob/master/Commands.md)
* 7: Watch it go.


+ 0
- 78
bot.js~ View File

@@ -1,78 +0,0 @@
const Discord = require('discord.js');
const client = new Discord.Client();

// Express site serving
const express = require('express');
const app = express();
const bodyParser = require('body-parser');

// Message Array
const responseObject = {
"test": "It worked!",
"best booty": "Squigly, Duh.",
"best booty?": "Squigly, Duh.",
"!help": "Hello there, I'm a dumb bot written by [@calexil#9270](https://github.com/calexil) and [@Timberius#8180](https://github.com/TimboKZ) , you can see my commands here: https://github.com/calexil/BansheeBot/blob/master/Commands.md",
"!commands": "You can see my commands here: https://github.com/calexil/BansheeBot/blob/master/Commands.md"
};

// Reply to keywords in the array
client.on("message", (message) => {
if (responseObject[message.content]) {
message.channel.send(responseObject[message.content]);
}
});


// Reply to regex regarding best girl

let rg = /best g(ir|ri|ur)l+\??/ig;
let rh = /best b(oot)y+\??/ig;
client.on( "message", (message) => {
let m = message.content.replace( rg, "Big Band." );
let m = message.content.replace( rh, "Squigly, duh." );
if( m != message.content ) {
message.channel.send(m);
}
} );


// Call the web page with express
app.use(express.static('public'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));

// Listen for the users local script to post the current track and log it to console
app.listen(process.env.PORT, () => console.log(`App listening on port ${process.env.PORT}!`))
app.post('/endpoint', (req, res) => {
let trackName = req.body.trackName;
res.send('Track received!');
console.log(`Received ${trackName}`);


// Post the current track in discord
if (musicChannel) {
musicChannel.send(trackName);
}
});

// Make sure the bot is in the correct channel and show that the bot has launched successfully in console
client.on('ready', () => {
let musicChannelId = '318919013101076481'; //This number will need too be set you your desired channel id
musicChannel = client.channels.find(channel => channel.id === musicChannelId);
if (!musicChannel) console.error('Could not find music channel!');

console.log('I am ready!');
});

// Ping server every 15 minutes to prevent web dyno from sleeping
var http = require("http");
setInterval(function() {
http.get('http://bansheebot.herokuapp.com');
}, 1500000);

// Do not change
client.login(process.env.BOT_TOKEN);

Loading…
Cancel
Save