We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何使用用户贡献技能 Wol,我在 .wukong/config.yml 中设置以下配置:
# WOL启动 wol: enable: true ip: '192.168.1.255' mac: 'B0-25-AA-2F-9E-EA'
然后输入指令:开启电脑,只有机器人返回的一些回答,请问问题出来哪里?是需要去下载这些插件使用吗?
开启电脑
The text was updated successfully, but these errors were encountered:
wukong-contrib-master里有这个插件
import socket from robot import config, logging from robot.sdk.AbstractPlugin import AbstractPlugin
logger = logging.getLogger(name)
class Plugin(AbstractPlugin):
SLUG = "wol" def Waker(self, ip, mac): global sent def to_hex_int(s): return int(s.upper(), 16) dest = (ip, 9) spliter = "" if mac.count(":") == 5: spliter = ":" if mac.count("-") == 5: spliter = "-" parts = mac.split(spliter) a1 = to_hex_int(parts[0]) a2 = to_hex_int(parts[1]) a3 = to_hex_int(parts[2]) a4 = to_hex_int(parts[3]) a5 = to_hex_int(parts[4]) a6 = to_hex_int(parts[5]) addr = [a1, a2, a3, a4, a5, a6] packet = chr(255) + chr(255) + chr(255) + chr(255) + chr(255) + chr(255) for n in range(0,16): for a in addr: packet = packet + chr(a) packet = packet + chr(0) + chr(0) + chr(0) + chr(0) + chr(0) + chr(0) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1) s.sendto(packet,dest) if len(packet) == 108: sent = True def handle(self, text, parsed): profile = config.get() if self.SLUG not in profile or \ 'ip' not in profile[self.SLUG] or \ 'mac' not in profile[self.SLUG]: self.say('WOL配置有误,插件使用失败', cache=True) return ip = profile[self.SLUG]['ip'] mac = profile[self.SLUG]['mac'] try: self.Waker(ip,mac) if sent: self.say('启动成功', cache=True) except Exception as e: logger.error(e) self.say('抱歉,启动失败', cache=True) def isValid(self, text, parsed): return any(word in text for word in [u"开机", u"启动电脑", u"开电脑"])
Sorry, something went wrong.
插件里这句有问题s.sendto(packet,dest) 需要改成这样 s.sendto(packet.encode(),dest)
wzpan
No branches or pull requests
如何使用用户贡献技能 Wol,我在 .wukong/config.yml 中设置以下配置:
然后输入指令:
开启电脑
,只有机器人返回的一些回答,请问问题出来哪里?是需要去下载这些插件使用吗?The text was updated successfully, but these errors were encountered: