diff --git a/README.md b/README.md new file mode 100644 index 0000000..715b7b1 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# LXMFBot + +Python class to easily develop a simple Telethon style chatbot for the LXMF protocol. + +## Installation + +``` +$ pip install -r requirements.txt +``` + +## Usage + +- Instantiate the class with a name for the bot as parameter +- Use the `received` decorator to define functions for parsing received messages +- Use the `send(recipient_hash, message)` or `reply(message)` methods to send messages +- Launch the bot using the `run` method + +Example of a bot that echos a message back to the sender: + +```Python +from bot import LXMFBot + +bot = LXMFBot("NodeBot") + +@bot.received +def echo_msg(msg): + msg.reply(msg.content) + +bot.run() +``` \ No newline at end of file diff --git a/example.py b/example.py new file mode 100644 index 0000000..3f98381 --- /dev/null +++ b/example.py @@ -0,0 +1,9 @@ +from lxmfbot import LXMFBot + +bot = LXMFBot("NodeBot") + +@bot.received +def echo_msg(msg): + msg.reply(msg.content) + +bot.run() \ No newline at end of file diff --git a/bot.py b/lxmfbot.py similarity index 100% rename from bot.py rename to lxmfbot.py diff --git a/randobot.py b/randobot.py deleted file mode 100644 index e1a2baa..0000000 --- a/randobot.py +++ /dev/null @@ -1,10 +0,0 @@ -from bot import LXMFBot -from pprint import pprint - -bot = LXMFBot("Randobot") - -@bot.received -def echo_msg(msg): - msg.reply(msg.content) - -bot.run() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6d144ae --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +appdirs==1.4.4 +lxmf==0.3.1 +rns==0.5.2