Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DonDebonair committed Sep 3, 2017
1 parent 7c492d1 commit 70f1825
Show file tree
Hide file tree
Showing 15 changed files with 538 additions and 28 deletions.
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ It is **strongly recommended** that you install ``slack-machine`` inside a `virt
Usage
-----

#. Create a directory for your Slack bot: ``mkdir my-slack-bot && cd my-slack-bot``
#. Add a ``local_settings.py`` file to your bot directory: ``touch local_settings.py``
#. Create a Bot User for your Slack team: https://my.slack.com/services/new/bot (take note of your API token)
#. Add the Slack API token to your ``local_settings.py`` like this:
1. Create a directory for your Slack Machine bot: ``mkdir my-slack-bot && cd my-slack-bot``
2. Add a ``local_settings.py`` file to your bot directory: ``touch local_settings.py``
3. Create a Bot User for your Slack team: https://my.slack.com/services/new/bot (take note of your API token)
4. Add the Slack API token to your ``local_settings.py`` like this:

.. code-block:: python
SLACK_API_TOKEN = 'xox-my-slack-token'
#. Start the bot with ``slack-machine``
#. \...
#. Profit!
5. Start the bot with ``slack-machine``
6. \...
7. Profit!

Writing plugins
---------------
Expand Down
23 changes: 23 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = SlackMachine
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

livehtml:
sphinx-autobuild -b html --open-browser $(SOURCEDIR) $(BUILDDIR)/html

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
24 changes: 24 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
div.highlight pre {
padding: 11px 14px;
}

div#searchbox h3 {
text-transform: capitalize;
}

div.document {
width: 1008px;
}

@media screen and (max-width: 1008px) {
div.sphinxsidebar {
display: none;
}
div.document {
width: 100%!important;
}

div.highlight pre {
margin-right: -30px;
}
}
Binary file added docs/_static/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
190 changes: 190 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Slack Machine documentation build configuration file, created by
# sphinx-quickstart on Fri Sep 1 17:18:52 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))

import machine


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.viewcode'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'Slack Machine'
copyright = '2017, {}'.format(machine.__author__)
author = machine.__author__

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = machine.__version__
# The full version, including alpha/beta/rc tags.
release = machine.__version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'show_powered_by': False,
'github_user': 'DandyDev',
'github_repo': 'slack-machine',
'github_button': True,
'github_type': 'star',
'github_banner': True,
'show_related': False,
'note_bg': '#FFF59C',
'logo': 'logo.png'
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'SlackMachinedoc'


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'SlackMachine.tex', 'Slack Machine Documentation',
'Daan Debie', 'manual'),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'slack-machine', 'Slack Machine Documentation',
[author], 1)
]


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'SlackMachine', 'Slack Machine Documentation',
author, 'SlackMachine', 'One line description of project.',
'Miscellaneous'),
]

def setup(app):
app.add_stylesheet('css/custom.css')


70 changes: 70 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.. Slack Machine documentation master file, created by
sphinx-quickstart on Fri Sep 1 17:18:52 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Slack Machine
=============

.. image:: https://img.shields.io/pypi/v/slack-machine.svg
:target: https://pypi.python.org/pypi/slack-machine

.. image:: https://img.shields.io/pypi/l/slack-machine.svg
:target: https://pypi.python.org/pypi/slack-machine

.. image:: https://img.shields.io/pypi/pyversions/slack-machine.svg
:target: https://pypi.python.org/pypi/slack-machine

.. image:: https://travis-ci.org/DandyDev/slack-machine.svg?branch=master
:target: https://travis-ci.org/DandyDev/slack-machine

.. image:: https://codecov.io/gh/DandyDev/slack-machine/branch/master/graph/badge.svg
:target: https://codecov.io/gh/DandyDev/slack-machine

Slack Machine is a sexy, simple, yet powerful and extendable Slack bot. More than just a bot,
Slack Machine is a framework that helps you develop your Slack team into a ChatOps powerhouse.

Features
--------

- Get started with mininal configuration
- Built on top of the `Slack RTM API`_ for smooth, real-time interactions
- Support for rich interactions using the `Slack Web API`_
- High-level API for maximum convenience when building plugins
- Low-level API for maximum flexibility
- Plugin API features:
- Listen and respond to any regular expression
- Capture parts of messages to use as variables in your functions
- Respond to messages in channels, groups and direct message conversations
- Respond with Emoji
- Respond in threads
- Send DMs to any user
- Support for `message attachments`_
- Listen and respond to any `Slack event`_ supported by the RTM API

.. _Slack RTM API: https://api.slack.com/rtm
.. _Slack Web API: https://api.slack.com/web
.. _message attachments: https://api.slack.com/docs/message-attachments
.. _Slack event: https://api.slack.com/events

Coming Soon
"""""""""""

- Schedule actions and messages
- Plugin-accesible storage
- Help texts for Plugins
- ... and much more

User Guide
----------

.. toctree::
:maxdepth: 2

user/intro
user/install
user/usage

Writing Plugins
---------------

48 changes: 48 additions & 0 deletions docs/user/install.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.. _installation:

Installation
============

This part of the documentation helps you install Slack Machine with the least amount of friction,
or the most amount of flexibility.

Installing the easy way with pip
--------------------------------

Slack Machine is published to the `Python package index`_ so you can easily install Slack Machine using pip:

.. code-block:: bash
$ pip install slack-machine
It is **strongly recommended** that you install ``slack-machine`` inside a `virtual environment`_!

.. _Python package index: https://pypi.python.org/pypi/slack-machine
.. _virtual environment: http://docs.python-guide.org/en/latest/dev/virtualenvs/

Installing from source
----------------------

If you are adventurous, want to modify the core of your Slack Machine instance and want maximum
flexibility, you can also install from source. This way, you can enjoy the latest and greatest!

You can either clone the public repository:

.. code-block:: bash
$ git clone git://github.com/DandyDev/slack-machine.git
Or, download the `tarball <https://github.com/DandyDev/slack-machine/tarball/master>`_:

.. code-block:: bash
$ curl -OL https://github.com/DandyDev/slack-machine/tarball/master
# optionally, zipball is also available (for Windows users).
Once you have a copy of the source, you can embed it in your own Python
package, or install it into your site-packages easily:

.. code-block:: bash
$ cd slack-machine
$ pip install .
Loading

0 comments on commit 70f1825

Please sign in to comment.