die_roller_bot

C0mmandBot for Nextcloud Talk - FORK

A simple bot to help with repeating questions, tasks, and a bit of fun. This fork has a die rolling and tarot card drawing function as well.

๐Ÿณ Installation (Nextcloud AIO)

This bot is a Nextcloud app-based bot โ€” it runs inside the PHP process and self-registers with Talk automatically when enabled. No external server or webhook configuration is needed.

Requirements: Nextcloud 31โ€“33 with the Talk app installed and enabled.

1. Check your Nextcloud version

docker exec --user www-data nextcloud-aio-nextcloud php occ status

2. Copy the app into the container

The destination folder name must be c0mmand_bot to match the app ID.

docker cp /path/to/die_roller_bot \
  nextcloud-aio-nextcloud:/var/www/html/custom_apps/c0mmand_bot

3. Fix file ownership

docker exec --user root nextcloud-aio-nextcloud \
  chown -R www-data:www-data /var/www/html/custom_apps/c0mmand_bot

4. Enable the app

This triggers the install repair step, which generates a shared secret and registers the bot with Talk automatically.

docker exec --user www-data nextcloud-aio-nextcloud \
  php occ app:enable c0mmand_bot

5. Verify the bot is registered

Note the botโ€™s ID from the output โ€” youโ€™ll need it in the next step.

docker exec --user www-data nextcloud-aio-nextcloud \
  php occ talk:bot:list

You should see an entry named C0mmandBot with the URL nextcloudapp://c0mmand_bot.

6. Add the bot to a conversation

Bots are registered server-wide but must be added to each conversation individually. The conversation token is the short alphanumeric string visible in the Talk URL when you open a conversation.

docker exec --user www-data nextcloud-aio-nextcloud \
  php occ talk:bot:setup <bot-id> <conversation-token>

Alternatively, a conversation moderator can do this through the Talk UI: open the conversation โ†’ โ‹ฎ menu โ†’ Conversation settings โ†’ Bots, then toggle C0mmandBot on.

7. Test it

Send !command in the conversation โ€” the bot should reply with its list of available commands.

Notes:

๐Ÿ’ฌ Default commands for all participants

๐ŸŽฒ Dice Rolling

Roll any combination of dice using standard RPG notation:

!roll 2d6
!roll 1d20+5
!roll 4d8-2

Returns each individual die result and the final total.

โš”๏ธ Advantage and Disadvantage

Add adv or dis to roll twice and automatically use the higher or lower result:

!roll 1d20 adv
!roll 1d20 dis
!roll 2d6+3 adv

Both rolls are shown, followed by the final result:

Roll 1: Rolled 12 + (5)
For a total of 17
Roll 2: Rolled 4 + (5)
For a total of 9
FINAL ROLL: 17

๐Ÿ”ฎ Tarot

!tarot

Draws a random tarot card (upright or reversed) and returns a short narrative interpretation. The response weaves together the card, its orientation, and a randomly chosen meaning into a single sentence:

!tarot

Example response:

#The Moon in shadow: Your hopes and fears is about being wary of self-deception and avoidance

๐Ÿƒ !ltarot

Draws a random tarot card and returns the full general interpretation from an extended tarot guide, with no additional framing or narrative โ€” just the plain reading:

!ltarot

Cards drawn 1โ€“78 are upright (light) interpretations; 79โ€“156 are reversed (shadow) interpretations.

Example response:

The Moon reversed can indicate that you are getting the feeling that something is not right but are repressing those feelings or being untruthful with yourself about a situation...

๐Ÿ”ฎ Fortune

Displays a random fortune pulled from the fortunes file:

!fortune

Example response:

๐Ÿ”ฎ Speaking the truth in times of universal deceit is a revolutionary act. - George Orwell

๐Ÿ“– Spell Lists

!spelllist

With no arguments, lists all available SRD spell lists by class name:

!spelllist

Response:

๐Ÿ“– Which spell list would you like?
- Bard
- Cleric
- Druid
- Paladin
- Ranger
- Sorcerer
- Warlock
- Wizard

To view the full spell list for a class, provide the class name (case-insensitive):

!spelllist Druid
!spelllist druid
!spelllist DRUID

All three return the contents of the Druid spell list.

!spells

Looks up a spell by name from the SRD spell library.

No argument โ€” prompts for input:

!spells
๐Ÿง™Please give at least the first letter of the spell.

Single letter โ€” returns all spells beginning with that letter:

!spells a

Exact or unique partial match โ€” returns the full spell description:

!spells Fireball
!spells fireb

Ambiguous partial match โ€” lists all matching spell names:

!spells fire
๐Ÿง™Choose from these spells:
- Fire Bolt
- Fire Shield
- Fire Storm
- Fireball

No match โ€” reacts with ๐Ÿ‘Ž.

๐Ÿ“š Adding spells and spell lists

Spell data comes from the Systems Reference Document (SRD). Adding content is straightforward:

No code changes or restarts are needed โ€” the bot reads the directory contents at runtime.

โš”๏ธ Classes

!class

Looks up a class description from the SRD.

No argument โ€” returns all available classes:

!class

Single letter โ€” returns all classes beginning with that letter:

!class b

Exact or unique partial match โ€” returns the full class description:

!class Druid
!class dru

Ambiguous partial match โ€” lists all matching class names:

!class r
โš”๏ธChoose from these classes:
- Ranger
- Rogue

No match โ€” reacts with ๐Ÿ‘Ž.

๐Ÿ“š Adding classes

Class data comes from the Systems Reference Document (SRD). To add a new class, add a .txt file to lib/SRD/class/. The filename (without extension) is the class name used for lookups. No code changes or restarts are needed.

๐ŸงŒ Monsters

!monsters

Looks up a monster stat block or description from the SRD.

No argument โ€” prompts for input:

!monsters
๐ŸงŒPlease give at least the first letter of the monster.

Single letter โ€” returns all monsters beginning with that letter:

!monsters d

Exact or unique partial match โ€” returns the full monster entry:

!monsters Beholder
!monsters beh

Ambiguous partial match โ€” lists all matching monster names:

!monsters dragon
๐ŸงŒChoose from these monsters:
- Black Dragon
- Blue Dragon
- Brass Dragon
- ...

No match โ€” reacts with ๐Ÿ‘Ž.

๐Ÿ“š Adding monsters

Monster data comes from the Systems Reference Document (SRD). To add a new monster, add a .txt file to lib/SRD/monsters/. The filename (without extension) is the monster name used for lookups. No code changes or restarts are needed.

๐Ÿช„ Magic Items

!magicitems

Looks up a magic item description from the SRD.

No argument โ€” prompts for input:

!magicitems
๐Ÿช„Please give at least the first letter of the magic item.

Single letter โ€” returns all magic items beginning with that letter:

!magicitems b

Exact or unique partial match โ€” returns the full item description:

!magicitems Bag of Holding
!magicitems bag of hol

Ambiguous partial match โ€” lists all matching item names:

!magicitems bag
๐Ÿช„Choose from these magic items:
- Bag Of Beans
- Bag Of Devouring
- Bag Of Holding
- Bag Of Tricks

No match โ€” reacts with ๐Ÿ‘Ž.

๐Ÿ“š Adding magic items

Magic item data comes from the Systems Reference Document (SRD). To add a new magic item, add a .txt file to lib/SRD/magic_items/. The filename (without extension) is the item name used for lookups. No code changes or restarts are needed.

๐Ÿ“‘ Nimble Rules

!nimble

Looks up a rule entry from the Nimble ruleset.

No argument โ€” returns all available Nimble rule entries:

!nimble

Single letter โ€” returns all Nimble rules beginning with that letter:

!nimble c

Exact or unique partial match โ€” returns the full rule entry:

!nimble Conditions
!nimble cond

Ambiguous partial match โ€” lists all matching rule names:

!nimble s
๐Ÿ“‘Choose from these nimble rules:
- Spells

No match โ€” reacts with ๐Ÿ‘Ž.

๐Ÿ“š Adding Nimble rules

To add a new Nimble rule entry, add a .md file to lib/SRD/nimble/. The filename (without extension) is the entry name used for lookups. No code changes or restarts are needed.

๐Ÿ“œ Rules

!rules

Looks up a rule entry from the SRD.

No argument โ€” returns all available rule entries:

!rules

Single letter โ€” returns all rules beginning with that letter:

!rules c

Exact or unique partial match โ€” returns the full rule entry:

!rules Combat
!rules comb

Ambiguous partial match โ€” lists all matching rule names:

!rules c
๐Ÿ“œChoose from these rules:
- Combat
- Conditions

No match โ€” reacts with ๐Ÿ‘Ž.

๐Ÿ“š Adding rules

Rule data comes from the Systems Reference Document (SRD). To add a new rule entry, add a .txt file to lib/SRD/rules/. The filename (without extension) is the entry name used for lookups. No code changes or restarts are needed.

๐Ÿ“– Custom Collections

!!

Browses custom content stored in lib/Custom/. Collections are subdirectories; each file inside is an entry.

No argument โ€” lists all available collections:

!!
๐Ÿ“– Which collection would you like?
- speeches
- tables

One argument โ€” lists all entries in a collection:

!! speeches
๐Ÿ“– Choose from:
- Harvest Speech
- Opening Ceremony
- Victory Address

Two arguments (quoted) โ€” quoted second argument is treated as a single substring; returns the entry directly if exactly one match, or offers a choice if multiple:

!! speeches "Harvest Speech"

Returns the contents of Harvest Speech.md (or whichever file contains that substring in its name).

Two arguments (unquoted) โ€” each space-separated word is an independent search term; a file matches if its name contains any of the words:

!! speeches The Binding Of
๐Ÿ“– Choose from these:
- The Artifact Device
- The Binding Of The Dark

No match โ€” reacts with ๐Ÿ‘Ž.

๐Ÿ“š Adding custom collections and entries

No code changes or restarts are needed.

โญ Commands for moderators only

A chat log showing the !command and some of the samples below

๐Ÿ’ก Ideas for commands you could add depending on your use case

Simply post each command youโ€™d like to add as a new message into your chat.

๐Ÿ’› Caring

!set !hug {sender} shows {mention} some love! ๐Ÿ’›
!set !praiseall {sender} praises the community! Thanks everyone for being awesome! We all have been praised already {count} times!

๐Ÿ“š Helping each other

!set !english The prefered language is English. This allows more people to understand discussions and participate in them.
!set !cb Checkout the Nextcloud Talk **C0mmandBot**! Get it now from the [Nextcloud App store](https://apps.nextcloud.com/apps/c0mmand_bot) and checkout the documentation in the [Readme](https://github.com/nextcloud/c0mmand_bot)!
!set !userdocs Have a read through the [Nextcloud Talk User documentation](https://docs.nextcloud.com/server/latest/user_manual/en/talk/index.html) to learn more about most of the features.
!set !issue Please raise an issue in the GitHub repository: https://github.com/nextcloud/c0mmand_bot/issues/new/choose

๐Ÿ—œ๏ธ Shortcutting

!set !brb {sender} is right back! ๐Ÿ”™
!set !afk {sender} went to see the world!๐Ÿšถโ€โžก๏ธ
!set !re {sender} is back at the desk! ๐Ÿ’ป