From 3e80a6effb23cce90c6e06d3f039eddd773f6d4f Mon Sep 17 00:00:00 2001 From: dymik739 Date: Wed, 3 May 2023 21:08:01 +0300 Subject: [PATCH] module-v2-example: add an example module to show off the new capabilities --- modules/module-v2-example/index.py | 16 ++++++++++++++++ modules/module-v2-example/meta.json | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 modules/module-v2-example/index.py create mode 100644 modules/module-v2-example/meta.json diff --git a/modules/module-v2-example/index.py b/modules/module-v2-example/index.py new file mode 100644 index 0000000..2c0ddde --- /dev/null +++ b/modules/module-v2-example/index.py @@ -0,0 +1,16 @@ +class Counter: + def __init__(self): + self.counter = 0 + + def call_count(self): + self.counter += 1 + return self.counter.et + +c = Counter() + +def get_num(): + return c.call_count() + +def process(message, path): + if message.text == "!v2-testing": + return f"Testing successful - this is call number {get_num()}" diff --git a/modules/module-v2-example/meta.json b/modules/module-v2-example/meta.json new file mode 100644 index 0000000..dc5c36c --- /dev/null +++ b/modules/module-v2-example/meta.json @@ -0,0 +1,6 @@ +{ + "version": 2, + "index_file": "index.py", + "start_on_boot": true, + "alias": "module-v2-example" +}