Dennis
57499db3f5
This commit includes the matrix bot API (https://github.com/shawnanastasio/python-matrix-bot-api/) and the first proof of concept that the plugin API works. Furthermore, it includes the first version of a plugin that acquires event from an Admidio setup (https://admidio.org).
32 lines
637 B
Python
Executable File
32 lines
637 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
This is Peter. Peter is using the Python Matrix Bot API
|
|
"""
|
|
|
|
import json
|
|
|
|
# Bot API import
|
|
from matrix_bot_api.matrix_bot_api import MatrixBotAPI
|
|
|
|
def main():
|
|
# Load the configuration
|
|
with open('config.json') as json_data:
|
|
config = json.load(json_data)
|
|
|
|
# Create an instance of the MatrixBotAPI
|
|
bot = MatrixBotAPI(config)
|
|
|
|
# Start polling
|
|
bot.start_polling()
|
|
|
|
# Infinitely read stdin to stall main thread while the bot runs in other
|
|
# threads.
|
|
try:
|
|
while True:
|
|
input()
|
|
except:
|
|
bot.cancel = True
|
|
|
|
if __name__ == "__main__":
|
|
main()
|