mirror of
https://github.com/hyper-neptune/yuuki.git
synced 2024-12-29 00:01:38 +08:00
Release v6.5.2
This commit is contained in:
parent
f1e3780f76
commit
ced4028785
4 changed files with 35 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
|||
Star Yuuki(pYthon) BOT - Yuuki
|
||||
==================
|
||||
![Version](https://img.shields.io/badge/v6.5.2-OpenSource-FF0033.svg) ![Series](https://img.shields.io/badge/syb_Yuuki-Series-7700FF.svg) ![License](https://img.shields.io/badge/license-MPL--2.0-FF6600.svg) ![Python](https://img.shields.io/badge/python-3.x-0066FF.svg) ![Platform](https://img.shields.io/badge/base_on-LINE-00DD00.svg)
|
||||
![Version](https://img.shields.io/badge/v6.5.2-OpenSource-FF0033.svg) ![Series](https://img.shields.io/badge/syb-Series-7700FF.svg) ![License](https://img.shields.io/badge/license-MPL--2.0-FF6600.svg) ![Python](https://img.shields.io/badge/python-3.x-0066FF.svg) ![Platform](https://img.shields.io/badge/base_on-LINE-00DD00.svg)
|
||||
|
||||
A Python BOT for LINE Group Protection with LINE Unofficial API.
|
||||
![ICON](logo.png)
|
||||
|
@ -21,6 +21,7 @@ Recommand Environment:
|
|||
Ubuntu >= 18.04
|
||||
python >= 3.7
|
||||
pip >= 19.2
|
||||
git >= 2.17
|
||||
|
||||
You need the "LINE Unofficial API Core for Python". (Ex:[olsb](https://github.com/star-inc/olsb_cores), [akad](https://pypi.org/project/akad), [curve](https://pypi.org/project/curve) ...)
|
||||
|
||||
|
|
22
libs/data.py
22
libs/data.py
|
@ -155,7 +155,7 @@ class Yuuki_Data:
|
|||
|
||||
def _local_query(self, query_data):
|
||||
if type(query_data) is list:
|
||||
result = self.Data.copy()
|
||||
result = self.Data
|
||||
query_len = len(query_data)
|
||||
source_data = self.Data
|
||||
for count, key in enumerate(query_data):
|
||||
|
@ -189,8 +189,7 @@ class Yuuki_Data:
|
|||
|
||||
def syncData(self):
|
||||
if self.threading:
|
||||
sync = self._mdsShake("GET", [])
|
||||
self.Data = sync.get("data")
|
||||
self.Data = self.getData([])
|
||||
for Type in self.DataType:
|
||||
with self.file(Type, "w", "Data") as f:
|
||||
f.write(json.dumps(self.Data[Type]))
|
||||
|
@ -204,19 +203,22 @@ class Yuuki_Data:
|
|||
def _updateData(self, path, data):
|
||||
assert path and type(path) is list, "Empty path - updateData"
|
||||
if len(path) == 1:
|
||||
origin = self.getData([]).copy()
|
||||
origin_data = self.getData([])
|
||||
assert type(origin_data) is dict, "Error origin data type (1) - updateData"
|
||||
origin = origin_data.copy()
|
||||
origin[path[0]] = data
|
||||
data = origin
|
||||
path = []
|
||||
else:
|
||||
origin = self.getData(path[:-1]).copy()
|
||||
origin_data = self.getData(path[:-1])
|
||||
assert type(origin_data) is dict, "Error origin data type (2) - updateData"
|
||||
origin = origin_data.copy()
|
||||
origin[path[-1]] = data
|
||||
path = path[:-1]
|
||||
data = origin
|
||||
assert type(data) == dict, "Error data type - updateData"
|
||||
assert type(origin) is dict, "Error request data type - updateData"
|
||||
if self.threading:
|
||||
self._mdsShake("UPT", path, data)
|
||||
self._mdsShake("UPT", path, origin)
|
||||
else:
|
||||
self._local_update(path, data)
|
||||
self._local_update(path, origin)
|
||||
|
||||
def updateLog(self, Type, Data):
|
||||
if self.threading:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"""
|
||||
Star Inc. multiprocessing data switching
|
||||
===
|
||||
To switch data in multiprocessing tasks.
|
||||
To switch data in multiprocessor tasks.
|
||||
|
||||
LICENSE: MPL 2.0
|
||||
(c)2019 Star Inc.
|
||||
|
@ -49,7 +49,7 @@ def query(query_data, null=None):
|
|||
global switch_data
|
||||
try:
|
||||
if type(switch_data) is dict and type(query_data) is list:
|
||||
result = switch_data.copy()
|
||||
result = switch_data
|
||||
query_len = len(query_data)
|
||||
source_data = switch_data
|
||||
for count, key in enumerate(query_data):
|
||||
|
@ -101,7 +101,7 @@ class IndexHandler(RequestHandler):
|
|||
def get(self):
|
||||
self.write('''
|
||||
<b>Python MDS Server</b><br>
|
||||
To switch data in multiprocessing tasks.<hr>
|
||||
To switch data in multiprocessor tasks.<hr>
|
||||
(c)2019 <a href="https://starinc.xyz">Star Inc.</a>
|
||||
''')
|
||||
|
||||
|
|
|
@ -9,7 +9,13 @@ import socket, \
|
|||
|
||||
from git import Repo
|
||||
|
||||
try:
|
||||
from .core.TalkService import *
|
||||
except ImportError:
|
||||
print(
|
||||
"It's necessary to install \"core\" for LINE connection,\n"
|
||||
"Please read the \"README.md\" first."
|
||||
)
|
||||
|
||||
from .connection import Yuuki_Connect
|
||||
from .data import Yuuki_Data
|
||||
|
@ -268,7 +274,7 @@ class Yuuki:
|
|||
def limitReset(self):
|
||||
for userId in self.AllAccountIds:
|
||||
self.data.updateData(["LimitInfo", "KickLimit", userId], self.KickLimit)
|
||||
self.data.updateData(["LimitInfo", "KickLimit", userId], self.CancelLimit)
|
||||
self.data.updateData(["LimitInfo", "CancelLimit", userId], self.CancelLimit)
|
||||
|
||||
@staticmethod
|
||||
def dictShuffle(dict_object, requirement=None):
|
||||
|
@ -409,7 +415,7 @@ class Yuuki:
|
|||
|
||||
def JoinGroup(self, ncMessage):
|
||||
"""
|
||||
ToDo Type:
|
||||
Event Type:
|
||||
NOTIFIED_INVITE_INTO_GROUP (13)
|
||||
"""
|
||||
GroupInvite = []
|
||||
|
@ -452,7 +458,7 @@ class Yuuki:
|
|||
|
||||
def Commands(self, ncMessage):
|
||||
"""
|
||||
ToDo Type:
|
||||
Event Type:
|
||||
RECEIVE_MESSAGE (26)
|
||||
"""
|
||||
BlockedIgnore = (ncMessage.message.to in self.data.getData(["BlackList"])) or (ncMessage.message.from_ in self.data.getData(["BlackList"]))
|
||||
|
@ -643,8 +649,13 @@ class Yuuki:
|
|||
|
||||
elif self.YuukiConfigs["name"] + '/Com' == msgSep[0] and len(msgSep) != 1:
|
||||
if ncMessage.message.from_ in self.Admin:
|
||||
try:
|
||||
ComMsg = self.readCommandLine(msgSep[1:len(msgSep)])
|
||||
self.sendText(self.sendToWho(ncMessage), str(eval(ComMsg)))
|
||||
Report = str(eval(ComMsg))
|
||||
except:
|
||||
(err1, err2, err3, ErrorInfo) = self.errorReport()
|
||||
Report = "Star Yuuki BOT - Eval Error:\n%s\n%s\n%s\n\n%s" % (err1, err2, err3, ErrorInfo)
|
||||
self.sendText(self.sendToWho(ncMessage), Report)
|
||||
|
||||
elif ncMessage.message.contentType == ContentType.CONTACT:
|
||||
Catched = ncMessage.message.contentMetadata["mid"]
|
||||
|
@ -661,7 +672,7 @@ class Yuuki:
|
|||
|
||||
def Security(self, ncMessage):
|
||||
"""
|
||||
ToDo Type:
|
||||
Event Type:
|
||||
NOTIFIED_UPDATE_GROUP (11)
|
||||
NOTIFIED_INVITE_INTO_GROUP (13)
|
||||
NOTIFIED_ACCEPT_GROUP_INVITATION (17)
|
||||
|
|
Loading…
Reference in a new issue