Disabled a few modules by default, added docs and scripts for running locally.
This commit is contained in:
parent
cfe303d654
commit
19aaa1a546
23
README.md
23
README.md
|
@ -457,7 +457,7 @@ This module is disabled by default.
|
|||
* Log in as the newly created user (easiest is Element Web in private window)
|
||||
* Get user's access token (In Element Web see Settings / Help & about)
|
||||
|
||||
## Running on host
|
||||
## Running locally
|
||||
|
||||
Run something like (tested on Ubuntu):
|
||||
|
||||
|
@ -472,6 +472,27 @@ MATRIX_USER="@user:matrix.org" MATRIX_ACCESS_TOKEN="MDAxOGxvYlotofcharacters53Cg
|
|||
|
||||
NOTE: The Pipfile does not define the python version as it is always strict and causes problems. See https://github.com/pypa/pipenv/issues/1050 . Python 3.7 and 3.8 should both work fine.
|
||||
|
||||
## Running locally with systemd unit file (Raspberry Pi etc)
|
||||
|
||||
First modify run.sh and make sure Hemppa starts successfully with it.
|
||||
|
||||
There's a systemd unit file you can use. It assumes hemppa is installed to /opt/hemppa and
|
||||
is run as user pi in group pi. Note: this is probably not the smartest way to do this, feel free
|
||||
to do a PR for better way.
|
||||
|
||||
If your user is not pi, modify hemppa.service first.
|
||||
|
||||
``` bash
|
||||
sudo ln -s `pwd` /opt/hemppa
|
||||
sudo ln -s hemppa.service /lib/systemd/system
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable hemppa.service
|
||||
sudo systemctl start hemppa.service
|
||||
sudo systemctl status hemppa.service
|
||||
```
|
||||
|
||||
Status should show "Active: active (running)"
|
||||
|
||||
## Running with Docker
|
||||
|
||||
Create .env file and set variables:
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
[Unit]
|
||||
Description=Hemppa the Bot
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
StartLimitIntervalSec=500
|
||||
StartLimitBurst=5
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/hemppa/
|
||||
ExecStart=/opt/hemppa/run.sh
|
||||
StandardInput=tty-force
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
User=pi
|
||||
Group=pi
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -12,6 +12,7 @@ class MatrixModule(PollingService):
|
|||
self.poll_interval_random = 2
|
||||
self.owner_only = True
|
||||
self.send_all = True
|
||||
self.enabled = False
|
||||
|
||||
async def poll_implementation(self, bot, account, roomid, send_messages):
|
||||
try:
|
||||
|
|
|
@ -6,6 +6,7 @@ class MatrixModule(BotModule):
|
|||
super().__init__(name)
|
||||
self.bridges = dict()
|
||||
self.bot = None
|
||||
self.enabled = False
|
||||
|
||||
async def message_cb(self, room, event):
|
||||
if self.bot.should_ignore_event(event):
|
||||
|
|
|
@ -10,9 +10,12 @@ from modules.common.module import BotModule
|
|||
|
||||
|
||||
class MatrixModule(BotModule):
|
||||
api_key = None
|
||||
calendar_rooms = dict() # Roomid -> [calid, calid..]
|
||||
calendars = dict() # calid -> Calendar
|
||||
def __init__(self, name):
|
||||
super().__init__(name)
|
||||
self.api_key = None
|
||||
self.calendar_rooms = dict() # Roomid -> [calid, calid..]
|
||||
self.calendars = dict() # calid -> Calendar
|
||||
self.enabled = False
|
||||
|
||||
async def matrix_poll(self, bot, pollcount):
|
||||
if self.api_key:
|
||||
|
|
Loading…
Reference in New Issue