plugable-matrix-bot/run.py

36 lines
812 B
Python
Executable File

#!/usr/bin/env python3
"""
This is a Bot. He/she is using the Python Matrix Bot API
"""
__author__ = "Dennis Potter"
__copyright__ = "Copyright 2019, Dennis Potter"
__credits__ = ["Dennis Potter"]
__license__ = "GPL-3.0"
__version__ = "0.5.0"
__maintainer__ = "Dennis Potter"
__email__ = "dennis@dennispotter.eu"
import threading
# Bot API import
from matrix_bot_api.matrix_bot_api import MatrixBotAPI
def main():
# Create an instance of the MatrixBotAPI
bot = MatrixBotAPI()
# Start polling
bot.start_polling()
# Stall this thread while the bot runs in other threads. On ^C, this will
# indicate to all threads that they should cancel
try:
forever = threading.Event();
forever.wait()
except:
bot.cancel = True
if __name__ == "__main__":
main()