|
@@ -0,0 +1,57 @@
|
|
|
+import atexit
|
|
|
+from logging.config import dictConfig
|
|
|
+
|
|
|
+from flask import Flask, request, render_template
|
|
|
+
|
|
|
+from config import BOTS_LOOKUP
|
|
|
+from command_system import RollbotMessage
|
|
|
+from rollbot import Rollbot
|
|
|
+
|
|
|
+dictConfig({
|
|
|
+ "version": 1,
|
|
|
+ "formatters": {"default": {
|
|
|
+ "format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s",
|
|
|
+ }},
|
|
|
+ "handlers": {"wsgi": {
|
|
|
+ "class": "logging.StreamHandler",
|
|
|
+ "stream": "ext://flask.logging.wsgi_errors_stream",
|
|
|
+ "formatter": "default"
|
|
|
+ }},
|
|
|
+ "root": {
|
|
|
+ "level": "INFO",
|
|
|
+ "handlers": ["wsgi"]
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+app = Flask(__name__)
|
|
|
+
|
|
|
+rollbot = Rollbot(app.logger)
|
|
|
+rollbot.start_plugins()
|
|
|
+atexit.register(rollbot.shutdown_plugins)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+msg = RollbotMessage.from_web("!echo This is a test!")
|
|
|
+print(rollbot.run_command(msg).info)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+"""
|
|
|
+ if response.txt is not None:
|
|
|
+ post_message(response.txt, bot_id=bot_id)
|
|
|
+ if response.img is not None:
|
|
|
+ post_message(response.img, bot_id=bot_id)
|
|
|
+ else:
|
|
|
+
|
|
|
+ if message.group_id in BOTS_LOOKUP:
|
|
|
+ bot_id = BOTS_LOOKUP[msg.group_id]
|
|
|
+
|
|
|
+ if not response.respond:
|
|
|
+ self.logger.info(f"Skipping response to message {message.message_id}")
|
|
|
+ return
|
|
|
+
|
|
|
+ self.logger.info(f"Responding to message {message.message_id}")
|
|
|
+"""
|
|
|
+
|
|
|
+
|