一般为以下几种(正则由dream提供)
暗区[\S]*挂
暗区[\S]*辅助
暗区[\S]*g
三角洲[\S]*挂
三角洲[\S]*辅助
三角洲[\S]*g
卖[\s\S]*挂
卖[\s\S]*g
买[\s\S]*挂
买[\s\S]*g
谁[\S]*挂
谁[\S]*g
直装
外挂
和平[\S]*挂
和平[\S]*g
和平[\S]*辅助
开[\S]*挂
开[\S]*g
怎么[\S]*挂
怎么[\S]*g
卡密
以及一些常用绕过
桂 => 挂
gua => 挂
扌圭 => 挂
g => 挂
木圭 => 挂
gui => 挂
因此我用python写了个自动撤回脚本
import re
from RyhBotPythonSDK import Message, Server
Message.Token = ""
Send = Message.Send()
Delete = Message.Delete
block_list = [
r"暗区[\S]*挂",
r"暗区[\S]*辅助",
r"暗区[\S]*g",
r"三角洲[\S]*挂",
r"三角洲[\S]*辅助",
r"三角洲[\S]*g",
r"卖[\s\S]*挂",
r"卖[\s\S]*g",
r"买[\s\S]*挂",
r"买[\s\S]*g",
r"谁[\S]*挂",
r"谁[\S]*g",
r"直装",
r"外挂",
r"和平[\S]*挂",
r"和平[\S]*g",
r"和平[\S]*辅助",
r"开[\S]*挂",
r"开[\S]*g",
r"怎么[\S]*挂",
r"怎么[\S]*g",
r"卡密",
]
user_inputs: dict[str, list[dict[str, str]]] = {}
def char_filter(word: str) -> str:
pattern = r'[^\u4e00-\u9fa5a-zA-Z]'
word = re.sub(pattern, '', word)
word = word.lower()
word = word.replace("桂", "挂").replace("gua", "挂")
word = word.replace("扌圭", "挂").replace("g", "挂")
word = word.replace("木圭", "挂").replace("gui", "挂")
return word
def get_chat_info(data: dict) -> dict:
chat = data['chat']
if chat['chatType'] == 'group':
chatId = chat['chatId']
chatType = chat['chatType']
else:
chat = data['sender']
chatId = chat['senderId']
chatType = chat['senderType']
senderId = data['sender']['senderId']
msgId = data['message']['msgId']
return {
'chatId': chatId,
'chatType': chatType,
'senderId': senderId,
'msgId': msgId
}
@Server.Message.Normal
@Server.Message.Command
def MessageHandler(data: dict):
chat_info = get_chat_info(data)
chatId = chat_info['chatId']
chatType = chat_info['chatType']
senderId = chat_info['senderId']
msgId = chat_info['msgId']
send_content = char_filter(data['message']['content']['text'])
print(f"\n[{chatType}:{chatId}]/{senderId} => {send_content}\n")
if senderId not in user_inputs:
user_inputs[senderId] = []
user_inputs[senderId].append({"content": send_content, "msgId": msgId})
user_input_str = char_filter("".join([i['content'] for i in user_inputs[senderId]]))
for block_word in block_list:
if re.search(block_word, user_input_str):
for i in user_inputs[senderId]:
Delete(i["msgId"], chatId, chatType)
user_inputs[senderId] = []
Send.Text(chatId, chatType, "不被允许的输入!")
break
if len(user_input_str) > 200:
user_inputs[senderId] = []
Server.Start(
host='0.0.0.0',
port=58564,
)