Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
rtfd
Browse files Browse the repository at this point in the history
  • Loading branch information
runarsf committed Jul 16, 2019
1 parent b91020a commit e869193
Show file tree
Hide file tree
Showing 40 changed files with 15,443 additions and 134 deletions.
18 changes: 0 additions & 18 deletions debug-docker-compose.yml

This file was deleted.

16 changes: 0 additions & 16 deletions debug-dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ services:
volumes:
- ./src:/app
#- ./logs:/app/logs
ports:
- 8080:8080
#ports:
#- 8080:8080
3 changes: 2 additions & 1 deletion dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN python3 -m pip install -U -r /app/requirements.txt
#COPY ./src /app
WORKDIR /app

EXPOSE 8080
#EXPOSE 8080

CMD ["python3", "-u", "rufus.py"]
#CMD ["python3", "-u", "-m", "trace", "--trace", "./rufus.py", "|", "grep", "rufus.py"]
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

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

.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)
Binary file added docs/_build/doctrees/dev.doctree
Binary file not shown.
Binary file added docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/_build/doctrees/index.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 4ccaa22f1a3c6b5adee7dfb7e6dba529
tags: 645f666f9bcd5a90fca523b33c5a78b7
200 changes: 200 additions & 0 deletions docs/_build/html/_sources/dev.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
Running your own instance
=========================

API Keys and tokens
-------------------

The bot requires some API keys in order to work properly. Make sure not
to share any of these keys with anyone, think of them as passwords.

+---------------------------+-------------------+-----------+-----------+
| Service | Where | How | Why |
+===========================+===================+===========+===========+
| Discord bot token | `Discord | If you | This is |
| | Developer | don’t | required |
| | Portal`_ | have an | to login |
| | | applicati | to your |
| | | on | bot’s |
| | | for your | user |
| | | bot | profile. |
| | | already, | |
| | | `create | |
| | | one`_ in | |
| | | the | |
| | | developer | |
| | | portal. | |
| | | Head to | |
| | | ``General | |
| | | Informat | |
| | | ion`` | |
| | | in your | |
| | | bot’s | |
| | | user | |
| | | page, | |
| | | click | |
| | | ``Click t | |
| | | o reveal` | |
| | | ` | |
| | | (under | |
| | | ``CLIENT | |
| | | SECRET``) | |
+---------------------------+-------------------+-----------+-----------+
| Wolfram Alpha API | `Wolfram|Alpha | Click | Used with |
| | APIs`_ | ``Get API | the |
| | | Access`` | ``query`` |
| | | under | command. |
| | | ``Get Sta | |
| | | rted for | |
| | | Free`` | |
| | | and fill | |
| | | in the | |
| | | required | |
| | | informati | |
| | | on. | |
+---------------------------+-------------------+-----------+-----------+
| osu! API | `Request API | Refer to | Used with |
| | access`_ | the `osu! | commands |
| | | api | in the |
| | | wiki`_. | osu! cog. |
+---------------------------+-------------------+-----------+-----------+
| Omdb API | `Generate API | Select | Used with |
| | key`_ | ``FREE! ( | the |
| | | 1,000 dai | ``imdb`` |
| | | ly limit) | command. |
| | | `` | |
| | | and enter | |
| | | a valid | |
| | | email | |
| | | address | |
| | | (temporar | |
| | | y | |
| | | emails | |
| | | are | |
| | | purged.) | |
+---------------------------+-------------------+-----------+-----------+
| LastFM API | `Create API | Enter the | Used with |
| | account`_ | necessary | the |
| | | informati | ``lastfm` |
| | | on. | ` |
| | | Callback | command. |
| | | URL is | |
| | | not | |
| | | required. | |
+---------------------------+-------------------+-----------+-----------+

Saving your tokens for use with the bot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy the `template-secrets.json`_ from the main repository and name it
``secrets.json``. Put it in the same directory as
``template-secrets.json`` (``rufus/src/secrets.json``). Fill in the keys
with the appropriate values.

.. code:: json
{
"botToken": "s3cr47-b07-70k3n",
"wolfram": "w01fr4m-k3y",
"osu": "p3r-4-m4nc3-p01n75",
"omdb": "m0v135-4nd-53r135",
"lastfm": "11573n-2-mu51c"
}
Setting up your environment
---------------------------

Clone the repository -
``git clone -b master https://github.com/runarsf/rufus.git``

With docker
~~~~~~~~~~~

Prerequisites
'''''''''''''

::

git
docker
docker-compose

``WARNING`` Do not run docker as root!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This can cause docker to change the ownerships of some files to root. If
you’re having troubles with docker or docker-compose, run this to add
yourself to the docker group. The command will take effect on next
login, and will be effective in your current shell session.

.. code:: bash
newgrp docker
systemctl start docker
Starting the bot
^^^^^^^^^^^^^^^^

.. code:: bash
docker-compose up -d
docker-compose logs -f
Rebuilding
^^^^^^^^^^

.. code:: bash
docker-compose build
Stopping
^^^^^^^^

.. code:: bash
docker-compose down
Without docker
~~~~~~~~~~~~~~

.. _prerequisites-1:

Prerequisites
^^^^^^^^^^^^^

::

git
python>=3.6
pip>=9.0.1
docker
docker-compose

- As well as all of the Python packages in `requirements.txt`_.

- Can be easily installed with
``python3 -m pip install -r ./requirements.txt``

- Docker is still needed in use with the runner command.

Detaching from the process but still leaving it running
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I suggest using tmux, these commands should be able to get you started.
You can detach from a session using :kbd:`CTRL+b` :kbd:`d` to quit.

::

# Create a new session.
tmux new -s rufus
# Attach to existing session
tmux a -t rufus

.. _Discord Developer Portal: https://discordapp.com/developers/applications/
.. _create one: https://discordjs.guide/preparations/setting-up-a-bot-application.html
.. _Wolfram|Alpha APIs: https://products.wolframalpha.com/api/
.. _Request API access: https://osu.ppy.sh/p/api
.. _osu! api wiki: https://github.com/ppy/osu-api/wiki
.. _Generate API key: https://www.omdbapi.com/apikey.aspx
.. _Create API account: https://www.last.fm/api/account/create
.. _template-secrets.json: https://github.com/runarsf/rufus/blob/master/src/template-secrets.json
.. _requirements.txt: https://github.com/runarsf/rufus/blob/master/src/requirements.txt
98 changes: 98 additions & 0 deletions docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
rufus documentation
===================

.. toctree::
:maxdepth: 2
:caption: Contents:

dev
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`



rufus
=====

|Travis Build| |Codacy Badge|\ |Made With Python|

`Invite link`_ \ `Server Link`_ \ ``rufus#0001``

An `open-source`_ versatile|multipurpose `Discord`_ bot made with
discord.py

Getting started
---------------

There are several ways of utilizing Rufus for yourself, the following is
a brief documentation on how to get it up and running as swiftly as
possible.

Using an existing instance
~~~~~~~~~~~~~~~~~~~~~~~~~~

- `Add`_ the bot to your own server.
- Type ``rufus help`` for a list of all commands and prefixes.
- ``Disclaimer:`` All bot-PMs, commands, mentions and errors will be
logged, the logfile is cleared regularly and is only read if the bot
is running into problems and/or for debugging purposes.

Running your own instance
~~~~~~~~~~~~~~~~~~~~~~~~~

- You have two options when it comes to hosting your own instance; you
can run the application without any *abstraction layer*, or use
docker and docker-compose. Refer to the `developer docs`_ to get
started.

Contributing
------------

|Open Source| |License|

This software is licensed under the `MIT license`_, you are free to
contribute and/or modify the code as you wish, conforming to the
`license file`_. If you want more information on how to contribute,
refer to `CONTRIBUTING.md`_.

Shenanigans
-----------

- `Trello`_ board.
- The `Wiki`_ has some additional info.
- `Dev Bot`_.
- `Status updates`_.
- You are free to remove certain bot permission as you please, note
that this might restrict certain commands.
- Don’t hesitate to contact me about any problems you might be
experiencing!

|Travis Build History|

.. _Invite link: https://discordapp.com/oauth2/authorize?client_id=387390496038977536&scope=bot&permissions=2146958591
.. _Server Link: https://discordapp.com/invite/9sVk3Jh
.. _open-source: https://opensource.org/about
.. _Discord: https://discordapp.com/
.. _Add: https://discordapp.com/oauth2/authorize?client_id=387390496038977536&scope=bot&permissions=2146958591
.. _developer docs: https://github.com/runarsf/rufus/wiki/Developer-docs
.. _MIT license: https://opensource.org/licenses/MIT
.. _license file: https://github.com/runarsf/rufus/blob/master/LICENSE
.. _CONTRIBUTING.md: https://github.com/runarsf/rufus/blob/master/CONTRIBUTING.md
.. _Trello: https://trello.com/b/i7fwOpdK
.. _Wiki: https://github.com/runarsf/rufus/wiki
.. _Dev Bot: https://discordapp.com/oauth2/authorize?client_id=583992813553713178&scope=bot&permissions=2146958591
.. _Status updates: https://discordapp.com/invite/9sVk3Jh

.. |Travis Build| image:: https://img.shields.io/travis/runarsf/rufus.svg?style=flat
:target: https://travis-ci.org/runarsf/rufus
.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/44085548370046aeb594cde49bfc7ce8
:target: https://www.codacy.com/app/runarsf/rufus?utm_source=github.com&utm_medium=referral&utm_content=runarsf/rufus&utm_campaign=Badge_Grade
.. |Made With Python| image:: https://img.shields.io/badge/made%20with-python-%23306998.svg?style=flat
:target: https://www.python.org/
.. |Open Source| image:: https://img.shields.io/badge/open%20source-%E2%9D%A4-%23f44663.svg?style=flat
:target: https://opensource.org/
.. |License| image:: https://img.shields.io/badge/license-MIT-yellow.svg?style=flat
:target: https://opensource.org/licenses/MIT
.. |Travis Build History| image:: https://buildstats.info/travisci/chart/runarsf/rufus
:target: https://travis-ci.org/runarsf/rufus/builds

0 comments on commit e869193

Please sign in to comment.