Dennis Potter
ca86ade0fa
Before this commit, the name of the bot had to be hard coded into every plugin. Now, the name of the bot to which it should be sensitive can be set in the global config.hjson. Furthermore, the default sensitivity of a plugin is only recognized at the beginning of a sentence and is case insensitive. Finally, the possibility to add aliases for plugins is added.
36 lines
812 B
Python
Executable File
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()
|