コード例 #1
0
ファイル: views.py プロジェクト: sanaerosen/meowbot
def interactive():
    data = request.values.get('payload', type=json.loads)
    meowbot.log.debug(data)

    get_queue().enqueue(process_interactive, data=data)

    return Response(status=200)
コード例 #2
0
ファイル: views.py プロジェクト: sanaerosen/meowbot
def meow():
    data = request.get_json()
    meowbot.log.debug(data)

    # Slack URL verification check
    if data['type'] == 'url_verification':
        return jsonify({"challenge": data['challenge']})

    get_queue().enqueue(process_request, data=data)

    return Response(status=200)
コード例 #3
0
 def get_message_args(self, context: CommandContext):
     if len(context.args) == 0:
         yield {"text": "expected at least one argument"}
         return
     subcommand = context.args[0]
     queue = get_queue()
     failed_registry = queue.failed_job_registry
     task_count = failed_registry.count
     if subcommand == "size":
         yield {"text": f"Failed queue size: {task_count}"}
     elif subcommand == "empty":
         yield {"text": f"Removing {task_count} failed tasks"}
         job_ids = failed_registry.get_job_ids()
         for job_id in job_ids:
             failed_registry.remove(job_id)
         yield {"text": "Cleanup complete! :catkool:"}
     else:
         yield {"text": f"Unknown subcommand: {subcommand}"}