Jump to content
vampwood

Discord Dice Roller Bot

Recommended Posts

Been wanting a bot like this for awhile and finally bit the bullet and had a developer program one for me, and I wanted to just share it with everyone, so anyone can use it and don't have to rely on buggy hangouts or roll20 api.

http://puu.sh/urrFi/d092b89fd8.zip

You can download the bot here.

First please create a user for your bot by following this link.
https://discordapp.com/developers/applications/me

Once you've filled out the name and description click click "create application" then on the new screen click "create bot user". If you need more help with bot creation, there are plenty of resources online to do so. You'll need to make note of your bot token once created and copy it to insert it later.
Y2ouW7I.gif
Afterwards, you'll just need to install NodeJS on your machine to allow you to host the bot. Download the most recent version here https://nodejs.org/en/

 

To start the bot, either use Start.bat OR EotE Dice Roller shortcut.
Do not move start.bat out of the folder, move/copy EotE Dice Roller file wherever you like.

The code is thoroughly commented and the code itself should read like plain English even to none programmers.

The suffixes for the dice rolls are as follows (can be found in the bot.js code comments):
7 unique dice in total
y = Yellow
g = Green
b = Blue
blk = Black
r = red
p = Purple
d OR w = destiny/white

Finally, the bot is structured so that the dice command can be used in any order. For example:

!roll 3b 2blk 4w executes the same as
!roll 4w 3b 2blk which is also the same as
!roll 4d 3b 2blk.

Take a look at the Config.json file to plug in your bot token and set the prefix for your commands.

 

*I will be adding a few more features such as text headers to the rolls and limiting the amount of dice in the roll*

Source Code here -

https://github.com/Astrydax/SWEotE-Discord-Dice-Roller

 

For more detailed usage instructions, there is a read me in the file and here https://github.com/Astrydax/SWEotE-Discord-Dice-Roller/blob/master/README.md .

Edited by vampwood

Share this post


Link to post
Share on other sites
5 hours ago, LegendsoftheGalaxy said:

This makes no sense to me.  I struggled with your instructions the entire way and in the end gave up on getting it to work after a 2 hours of trying.

 

Sorry you couldn't follow the instructions, but if you have the bot set up on discord, its very straight forward at that point. I'd suggest looking at guides on how to setup a discord bots if you're having problems.Y2ouW7I.gifThis gif may help explain the bot process better. Then once you've made it, and the bot is in your server, and you've copied the token code into the config.json by opening it with notepad, entering the token code between the quotation marks, and entered a prefix to use the codes, and have the bot in your server with the program running. It should work.

Edited by vampwood

Share this post


Link to post
Share on other sites
1 minute ago, LegendsoftheGalaxy said:

Yea that is as far as I got.  Then from that point I could not figure out how to get it to work

 

So you got your token, you entered it into the config.json and it doesn't work?

Share this post


Link to post
Share on other sites
1 minute ago, LegendsoftheGalaxy said:

Correct I added it in and it did not work

e5e9d05835.png  so your token would look like this? the token code being in example? You have the prefix set up?, and does the bot join the server once you start the start.bat?

Share this post


Link to post
Share on other sites

you're adding your prefix before that roll correct? so in my screenshot, my prefix is ! ,so for the bot to read my command, I have to put ! before the roll to get it to respond.

 

afc4d78508.png

Edited by vampwood

Share this post


Link to post
Share on other sites

I updated the readme for the bot to be very detailed. you can find it here https://github.com/Astrydax/SWEotE-Discord-Dice-Roller/blob/master/README.md

Few gotchas to check. Make sure you authorized your bot to join the server,  you'll know he's authorized if you see the bot you created hanging out on the right panel of your discord server where you see all your friends. Even if the bot is not running, he will appear there as "offline". If he's not there then the bot hasnt been authorized to use that server yet. Another Gotcha, make sure when you update and save "config.json.example" that you are saving it as "config.json" without the trailing ".example".  Finally, the only other gotcha I can think about is making sure you've installed NodeJS on your machine. You can find the latest version here  https://nodejs.org/en/.

Hope this helps

Edited by Astrydax

Share this post


Link to post
Share on other sites

I´m also experiencing problems...
It didn´t really come up in this conversation yet, but you´re supposed to click the EotE dice roller link file after inserting the token
into the json file...when I do that the windows console opens with an error that module discord.js can´t be found?
Don´t know where to go from there :(
 

Share this post


Link to post
Share on other sites

Ok, so I tried running both node.js and the start.bat as admin, now the complaint changed to cannot find module C:\Windows\system32\bot.js...
which is not where its supposed to search for the bot.js
Is this a compatibility issue maybe? I use windows 10 and the current node version (6.something)
Or is it just me being a noob with js and bots??
Maybe theres some small step lacking?
Don´t get me wrong, what you did there sounds super awesome, I can´t afford to get roll20 premium and
this seems to be a solid alternative!
It just doesn´t seem to work (for me) :(
 

Share this post


Link to post
Share on other sites
1 hour ago, MaxXIII said:

Also if that helps, the bot is in my server, just offline

you installed the node.js software linked above?https://nodejs.org/en/ and made sure you downloaded the latest, 7.x, since it seems you have 6.x installed, please uninstall that version and install the latest features version and try it then.

Edited by vampwood

Share this post


Link to post
Share on other sites

yeah tried with both latest and the recommended one, no luck :(
Another weird thing: is it normal that the bot token changes everytime I click the link above and select my bot?
Also is the .bat supposed to run through windows console or is that just bc of the error??

Share this post


Link to post
Share on other sites
8 minutes ago, MaxXIII said:

yeah tried with both latest and the recommended one, no luck :(
Another weird thing: is it normal that the bot token changes everytime I click the link above and select my bot?
Also is the .bat supposed to run through windows console or is that just bc of the error??

Are you extracting the zip and putting it into its own folder?

Share this post


Link to post
Share on other sites

No just in its own folder with nothing missing. If it can't find bot.js, something is going wrong. I'd suggest uninstalling Nodejs, delete everything related to this, and start fresh. following the read me. I'm using windows 10 myself, so I don't think thats the issue.

Edited by vampwood

Share this post


Link to post
Share on other sites

I reinstalled, still same problem :(
The start.bat runs via CMD and shows this error:

module.js:472
    throw err;
    ^
Error: Cannot find module 'C:\Windows\system32\bot.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:425:7)
    at startup (bootstrap_node.js:146:9)
    at bootstrap_node.js:540:3
 
No idea what I´m doing wrong here
 

Share this post


Link to post
Share on other sites

And its super weird, if I unclick admin rights for node.js,
This error pops up instead:

module.js:472
    throw err;
    ^
Error: Cannot find module 'discord.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Privat\Documents\SWEotE-Discord-Dice-Roller-master\bot.js:1:79)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
 

Share this post


Link to post
Share on other sites

I actually did not have java installed...maybe that was the problem...
Do i have to reinstall everything now?
Bc at the moment it doesn´t seem to work even with java installed now.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...