mirror of
https://github.com/hyper-neptune/yuuki.git
synced 2024-11-13 09:54:53 +08:00
57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Yuuki_Libs
|
|
(c) 2020 Star Inc.
|
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
"""
|
|
from .reader import Yuuki_WebDataReader
|
|
from ..tools import Yuuki_DynamicTools
|
|
|
|
|
|
class Yuuki_WebAdminAPI:
|
|
def __init__(self, Yuuki, WebAdmin_Handle):
|
|
self.Yuuki = Yuuki
|
|
self.WebAdmin = WebAdmin_Handle
|
|
self.YuukiData = self.Yuuki.data
|
|
self.Yuuki_DataHandle = Yuuki_WebDataReader(self.YuukiData)
|
|
self.events = {
|
|
"": self.nothing,
|
|
"get_logs": self.get_logs,
|
|
"get_helpers": self.get_helpers,
|
|
"get_groups_joined": self.get_groups_joined,
|
|
"shutdown": self.shutdown,
|
|
}
|
|
|
|
def action(self, *, task="", data=None):
|
|
return self.events[task](data)
|
|
|
|
def get_groups_joined(self, data):
|
|
if data:
|
|
pass
|
|
return self.YuukiData.getData(["Global", "GroupJoined"])
|
|
|
|
def get_helpers(self, data):
|
|
if data:
|
|
pass
|
|
return self.Yuuki.Connect.helper
|
|
|
|
def get_logs(self, data):
|
|
return self.Yuuki_DataHandle.get_logs(data)
|
|
|
|
def shutdown(self, data):
|
|
if data:
|
|
pass
|
|
return Yuuki_DynamicTools(self.Yuuki).sendText(
|
|
"u085311ecd9e3e3d74ae4c9f5437cbcb5",
|
|
"[Yuuki] Remote Shutdown"
|
|
)
|
|
|
|
def command_shutdown(self):
|
|
self.WebAdmin.wa_shutdown()
|
|
|
|
@staticmethod
|
|
def nothing(data):
|
|
if data:
|
|
pass
|