Giter Site home page Giter Site logo

slack-dnd-bot's Introduction

slack-dnd-bot

This is a small Slack Bot for talking "in character".

BEFORE YOU READ FURTHER

This is a bot I created for our own personal D&D game. We use Slack to schedule sessions, talk about the campaign, and sometimes talk "in character" between sessions to move the story along if we wish.

That being said, the character names in the dnd-bot.py file COULD BE SPOILERS. Review it at your own risk.

How does the bot work?

This bot allows you to talk "in character" in a Slack channel. Some examples:

> /bob Hello, world!
> /bob Excitedly | Hello, world!
> /gm Bob | Hello, world!
> /gm Bob | Excitedly | Hello, world!

You can also roll dice! It uses d20 so see their readthedocs for syntax.

> /bob roll | 1d20 + 5

The bot allows you to define specific slash commands for each character that you wish, but also has a GM command so the GM can talk as any NPC/Character they wish/need to. Each flash app.route is a unique slash command for each character you wish to define, including the GM slash command.

In the file is a c_map dictionary which allows you to define any (N)PC you wish and a custom Display Name and image to show up in the Slack message.

How to deploy

If you are new to testing and setting up a bot for Slack slash commands, this site has a wonderful writeup:

https://renzolucioni.com/serverless-slash-commands-with-python/

To get this running, simply replace their Python code with dnd-bot.py. NOTE: You will need to modify the c_map in dnd-bot.py to reflect your own characters and NPCs.

Also, they reference some environment variables in the code. Due to conflicts with other bots, the code uses these environment variables:

  • SLACK_DND_VTOKEN
  • SLACK_DND_TEAM_ID

Contributing

I would love contributions to make this bot better! Please submit an Issue and let me know what you'd like to see. Even better, once we agree on what should be added, please write it and submit a PR!

Stuff I thought about

  • Adding a spell lookup command, but since a lot of spells aren't publicly available, I felt it wasn't as useful as it could be.
  • Additional command features to express something else about the character speaking, how they are speaking, etc.

TODO

  • Add typing to dnd-boy.py to ensure code clarity and conformity.
  • Add example images so it's easier to see what things look like in Slack.

slack-dnd-bot's People

Contributors

mgoffin avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.