代码拉取完成,页面将自动刷新
import uiautomation as auto
from pypinyin import lazy_pinyin
import pickle
import time
import random
print("正在读取成语库,请稍后")
d = pickle.load(open("idiom.pk","rb"))
chat_name = input("请输入准确的聊天名称")
my_name = input("请输入我在群聊中的名称,以防止接龙自己")
print("程序将在3秒后启动,请讲TIM置顶并将光标锁定输入框")
for i in range(30):
print('\r'+'='*i + '>' + '.'*(30- i - 1), end='', flush=True)
time.sleep(0.1)
qq_ui = auto.WindowControl(searchDepth=1, ClassName="TXGuiFoundation")
fulian_window = qq_ui.ListItemControl(Name=chat_name)
last = ""
res = "。。"
while True:
if last != fulian_window.GetLegacyIAccessiblePattern().Value:
last = fulian_window.GetLegacyIAccessiblePattern().Value
if last.find(my_name) > -1 or res.find(fulian_window.GetLegacyIAccessiblePattern().Value) > -1:
continue
print(last)
try:
py_last = lazy_pinyin(last[-1])[0]
res = random.sample(d[py_last], 1)[0]
print(res)
auto.SendKeys(res)
auto.SendKeys('{enter}')
except:
pass
else:
time.sleep(1)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。