Can we have a random number generator?

Great! Looks good. I haven’t used GitHub, this will be an overdue education in such things. I’ll try to get familiar with it this week. I exported the sql I’m working with, do I drop it in the “test” directory or something?

2 Likes

@discbot roll d0 once.

4 Likes

As long as you don’t mind the data being public. :slight_smile: Probably adding a data folder would make sense. You can start up discbot locally by running the coffee file in /bin.

For testing purposes, try setting up discourse locally. It will take forever to download all the gems, but you can go wild on your local machine. https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md

2 Likes

Heh. Ok, that’s not happening tonight. I’ll see if I can get to it during the week.

Given my peculiar skill set, it might be easiest if I just built a call and response script for your discbot to talk to.

4 Likes

Oh totally, that makes it a lot simpler if you have a REST api ready.

I’ve got no previous experience with Coffeescript, this should be a great time as any to learn :slight_smile:

Robot, no battery… what could go wrong?

1 Like

@discbot roll d1 twice

@OtherMichael, the d1 dice reads: 1

1 Like

@discbot roll d2 roll d2

@OtherMichael, the d2 dice reads: 1

@discbot, you are crazy-y-y smart!

roll 2d36

@discbot roll 3d6

@discbot please roll a d999

@discbot roll 3d-1

@discbot roll d999

@OtherMichael, the d999 dice reads: 699

@discbot roll d-89

Hey, everybody - currently, @discbot has very simple rolling procedures. If you can parse regular expressions (and coffeescript) you can follow along here: https://github.com/gwwar/discbot/blob/master/src/scripts/dice.coffee @gwwar pointed this out about, but mostly in the context of adding more scripts.

If you have a look at the link you’ll see:

```robot.respond /roll d(\d+)/i, (post, match) ->``

The regular expression is the characters between the two-slashes, plus the following i - which means “ignore case”. This means that @discbot is looking the word “roll” followed by the letter d, followed by 1 or more digits (\d or “slash d” or “escape(d)-d” is a special regex entity). The value of the digits will be used as the limit of the die. Subsequent code (not included hear) will only pay attention to the numbers from 1…999 (inclusive).

So “roll 3d6” will be ignored
“roll d6 three times” will be responded to, but " three times" will be ignored.
“roll d-6” will be ignored, because something comes between the “d” and the digits
“roll d 6” will also be ignored, because something comes between the “d” and the digits.

4 Likes