plugable-matrix-bot/run.py

32 lines
637 B
Python
Raw Normal View History

#!/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()