This repository was archived by the owner on Feb 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.py
More file actions
70 lines (52 loc) · 1.66 KB
/
index.py
File metadata and controls
70 lines (52 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Copyright © 2020 ghostworker.All Rights Reserved.
#
# This module:the index of abled things
#
import os
import re
import asyncio
from send_message import *
import please_tell
import agent
import function
import image
import nbtread
import baike
async def main(pkt, client, command, global_var):
# 判断是否为玩家信息,有可能是指令回包
if pkt["type"] == "message":
message = pkt["message"].split(" ")
# 用于处理连续的多个空格
removes = []
for i in range(len(message)):
message[i] = message[i].replace(" ","")
if message[i] == "":
removes.append(i)
for each in removes:
message.pop(each)
if pkt["type"] == "message":
cmd = message[0]
# 涉及建筑导入部分
if re.search(r"^#func",cmd):
function.build(message, client, global_var)
elif re.search(r"^#nbt",cmd):
nbtread.nbtfile(client, message, global_var)
elif re.search("^#pic",cmd):
image.pic(message,client,global_var)
# =========== 其他部分 =================================================
elif re.search(r"^#ag-create",cmd):
await client.send(command("agent create"))
elif re.search(r"^#ag-attack",cmd):
agent.attack(message,client)
elif re.search(r"^#ag-tp",cmd):
# 传 pkt 为了传送方便
agent.tp(message,client)
elif re.search(r"^#ag-cmd",cmd):
agent.cmd(message,client)
elif re.search(r"^#baike",cmd):
baike.baike(message,client)
elif re.search("^#shutdown",cmd):
pid = os.getpid()
os.system(f"kill {pid}")
elif re.search("^#restart",cmd):
os.system("python restart.py "+str(os.getpid()))