Dennis
0d32c727fa
This commit adds a convenient installation script for Linux and also adds a description on how to install the bot. Furthermore, a very simple example plugin is added. This way, new users can easily discover the possibilities of this plugin. Finally, the default character "Peter"---which is used within Alcuinus---is removed, and a more generic character is added.
45 lines
1.0 KiB
Python
Executable File
45 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
This is Peter. Peter 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 json
|
|
import os
|
|
import time
|
|
import threading
|
|
|
|
# Bot API import
|
|
from matrix_bot_api.matrix_bot_api import MatrixBotAPI
|
|
|
|
CONFIG_LOCATION = os.path.join(os.path.dirname(__file__), 'config.json')
|
|
|
|
def main():
|
|
# Load the configuration
|
|
with open(CONFIG_LOCATION) as json_data:
|
|
config = json.load(json_data)
|
|
|
|
# Create an instance of the MatrixBotAPI
|
|
bot = MatrixBotAPI(config)
|
|
|
|
# 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()
|