From 088de5812db01a1860a3b39c9631665a5e8b92fd Mon Sep 17 00:00:00 2001 From: KrazyKirby99999 Date: Sat, 17 Jul 2021 15:22:16 +0000 Subject: [PATCH 1/2] Initial simple-matrix-bot-lib develop page --- .../projects/sdks/simple-matrix-bot-lib.mdx | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx diff --git a/gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx b/gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx new file mode 100644 index 0000000000..128fe5252c --- /dev/null +++ b/gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx @@ -0,0 +1,63 @@ +--- +layout: project +title: Simple-Matrix-Bot-Lib +categories: + - sdk +description: An easy to use bot library for the Matrix ecosystem written in Python. +repo: https://github.com/KrazyKirby99999/simple-matrix-bot-lib +featured: true +language: Python +author: KrazyKirby99999 +license: MIT +home: https://simple-matrix-bot-lib.readthedocs.io/ +room: "#simplematrixbotlib:matrix.org" +e2e: "no" +thumbnail: /docs/projects/images/python.png +screenshot: /docs/projects/images/python.png +maturity: Released +--- + +Simple-Matrix-Bot-Lib is a Python bot library for the Matrix ecosystem built on matrix-nio. + +[View on Github](https://github.com/KrazyKirby99999/simple-matrix-bot-lib) or [View on PyPi](https://pypi.org/project/simplematrixbotlib/) or +[View docs on readthedocs.io](https://simple-matrix-bot-lib.readthedocs.io/en/latest/) + +### Installation + +To install the simplematrixbotlib package, pip can be used: +```bash +$ pip install simplematrixbotlib +``` + +### Usage + +Python 3.5 or higher is required to use the simplematrixbotlib package. + + +#### Responding to a message +This example is compatable with simplematrixbotlib versions >= 1.3.0 +```python + +import simplematrixbotlib as botlib +import os + +creds = botlib.Creds("https://example.com", "user", "pass") +bot = botlib.Bot(creds) + +PREFIX = '!' + +async def echo(room, message): + """ + Example function that "echoes" arguements. + Usage: + example_user- !echo say something + echo_bot- say something + """ + match = botlib.MessageMatch(room, message, bot) + if match.not_from_this_bot() and match.prefix(PREFIX) and match.command("echo"): + await bot.api.send_text_message(room.room_id, match.args) + +bot.add_message_listener(echo) + +bot.run() +``` \ No newline at end of file From 19bec2798e6f921232cce0ce1adb728605398b11 Mon Sep 17 00:00:00 2001 From: KrazyKirby99999 <69373044+KrazyKirby99999@users.noreply.github.com> Date: Thu, 22 Jul 2021 08:10:24 -0500 Subject: [PATCH 2/2] Improve reference to matrix-nio in Simple-Matrix-Bot-Lib page Add link to "matrix-nio" text. Co-authored-by: Eric Eastwood --- gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx b/gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx index 128fe5252c..41c765d220 100644 --- a/gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx +++ b/gatsby/content/projects/sdks/simple-matrix-bot-lib.mdx @@ -17,7 +17,7 @@ screenshot: /docs/projects/images/python.png maturity: Released --- -Simple-Matrix-Bot-Lib is a Python bot library for the Matrix ecosystem built on matrix-nio. +Simple-Matrix-Bot-Lib is a Python bot library for the Matrix ecosystem built on [matrix-nio](https://github.com/poljar/matrix-nio) [View on Github](https://github.com/KrazyKirby99999/simple-matrix-bot-lib) or [View on PyPi](https://pypi.org/project/simplematrixbotlib/) or [View docs on readthedocs.io](https://simple-matrix-bot-lib.readthedocs.io/en/latest/) @@ -60,4 +60,4 @@ async def echo(room, message): bot.add_message_listener(echo) bot.run() -``` \ No newline at end of file +```