Shall we mod our discobot?

discourse
discobot
Tags: #<Tag:0x00007f4781a1a430> #<Tag:0x00007f4781a1a2f0>

#1

Did you know we have a @discobot? It’s true!

That blog post goes into some details, so check it out, and if you have a recommendation, let’s hear it!

You can probably send a private message to @discobot… what will happen?!


#2

Hi! To find out what I can do, say @discobot display help.


#3

@discobot display help


#4

I currently know how to do the following things:

@discobot start new user

Starts one of the following interactive narratives: new user, advanced user.

@discobot roll 2d6

:game_die: 3, 6

@discobot quote

:left_speech_bubble: Carry out a random act of kindness, with no expectation of reward, safe in the knowledge that one day someone might do the same for you — Princess Diana

@discobot fortune

:crystal_ball: You may rely on it


#5

Oh snap, we can @discobot roll 3d6 for RPG fun!


#6

:game_die: 5, 6, 2


#7

@discobot roll 4dF I wanna see if you support Fudge/Fate dice.


#8

Hi! To find out what I can do, say @discobot display help.


#9

What is the shortcut for getting Fate results from normal d6s? I don’t think the dice roller does operations, so no 1d6 - 1d6

In fact, the dice roller is fairly primitive:

module DiscourseNarrativeBot
  class Dice
    MAXIMUM_NUM_OF_DICE = 20
    MAXIMUM_RANGE_OF_DICE = 120

    def self.roll(num_of_dice, range_of_dice)
      if num_of_dice == 0 || range_of_dice == 0
        return I18n.t('discourse_narrative_bot.dice.invalid')
      end

      output = ''

      if num_of_dice > MAXIMUM_NUM_OF_DICE
        output << I18n.t('discourse_narrative_bot.dice.not_enough_dice',
          num_of_dice: MAXIMUM_NUM_OF_DICE
        )
        output << "\n\n"
        num_of_dice = MAXIMUM_NUM_OF_DICE
      end

      if range_of_dice > MAXIMUM_RANGE_OF_DICE
        output << I18n.t('discourse_narrative_bot.dice.out_of_range')
        output << "\n\n"
        range_of_dice = MAXIMUM_RANGE_OF_DICE
      end

      output << I18n.t('discourse_narrative_bot.dice.results',
        results: num_of_dice.times.map { rand(1..range_of_dice) }.join(", ")
      )
    end
  end
end

I don’t think they are ready to allow custom narratives for the bot yet, but we will definitely need to add dF support! Does anyone know Ruby or a Ruby Fate dice library?!


#10

Ive implemented one before off the cough in a couple of languages before, you can use the same algorithm as you would would use for a ‘d3’ , you just at the end subtract 2 from the total for each die rolled. Moving the range of (1, 2, 3) to (-1, 0, 1).


#11

Well, have to try a roll: @discobot roll 3d6


#12

:game_die: 6, 5, 2


#13

cool, that worked. @discobot roll 3d6


#14

:game_die: 6, 4, 4