2018-12-16 15:38:47 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
"""
|
2019-02-27 18:08:09 +00:00
|
|
|
This is a Bot. He/she is using the Python Matrix Bot API
|
2018-12-16 15:38:47 +00:00
|
|
|
"""
|
|
|
|
|
2019-01-12 14:13:21 +00:00
|
|
|
__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
|
2018-12-16 15:38:47 +00:00
|
|
|
|
|
|
|
# Bot API import
|
|
|
|
from matrix_bot_api.matrix_bot_api import MatrixBotAPI
|
|
|
|
|
|
|
|
def main():
|
|
|
|
# Create an instance of the MatrixBotAPI
|
2019-02-27 18:08:09 +00:00
|
|
|
bot = MatrixBotAPI()
|
2018-12-16 15:38:47 +00:00
|
|
|
|
|
|
|
# Start polling
|
|
|
|
bot.start_polling()
|
|
|
|
|
2019-01-12 14:13:21 +00:00
|
|
|
# Stall this thread while the bot runs in other threads. On ^C, this will
|
|
|
|
# indicate to all threads that they should cancel
|
2018-12-16 15:38:47 +00:00
|
|
|
try:
|
2019-01-12 14:13:21 +00:00
|
|
|
forever = threading.Event();
|
|
|
|
forever.wait()
|
2018-12-16 15:38:47 +00:00
|
|
|
except:
|
|
|
|
bot.cancel = True
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|