npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

hamibot-lib

v1.2.17

Published

Hamibot开发js库

Readme

hamibot-lib

hamibot-lib 是一个为 Hamibot 平台开发的 JavaScript 工具库,旨在简化 Hamibot 脚本的开发,提供一系列常用的自动化操作函数,包括设备控制、应用交互、屏幕识别、抖音自动化等。

安装

该库通常作为 Hamibot 项目的依赖项使用,通过 require 语句导入所需模块。

模块介绍

index.js (核心工具)

提供了 Hamibot 脚本的通用工具函数,例如:

  • swipeUnlock(): 上划解锁屏幕。
  • openApp(appName): 打开指定名称的应用。
  • closePopup(): 关闭可能存在的弹窗。
  • countDown(sec): 显示倒计时悬浮窗。
  • stopBtn(): 创建一个暂停/继续脚本的悬浮按钮。
  • doClick(x, y): 点击某个坐标点,兼容适配不同分辨率屏幕。
  • clickElem(elem): 点击 UI 元素。
  • doBack(): 返回上一页。
  • wait(start, end): 随机等待一段时间。
  • getScreenCapture(): 获取截屏权限。
  • recognizeText(): 截屏识别文字。
  • clickText(txt): 点击截屏识别到的文字。
  • recognizeImg(image, imgName): 截屏识别图片。
  • clickImg(image, imgName): 点击截屏识别到的图片。
  • recognizeColor(color, region, threshold): 截屏识别颜色。
  • showConsole(x,y,w,h): 显示 Hamibot 控制台。
  • postMessage(scriptName): 发送脚本运行报告。
  • log(txt): 记录日志。
  • toastLog(txt): 记录日志并显示 Toast 提示。

douyin.js (抖音自动化)

专注于抖音应用的自动化操作,例如:

  • getVideoDuration(sleepTime): 获取当前视频时长。
  • enterVideo(): 从视频列表页进入第一个视频。
  • exitVideo(): 从视频详情页返回到任务列表页。
  • doFavor(): 执行点赞操作。
  • doCollect(): 执行收藏操作。
  • doComment(content): 执行评论操作。
  • interactComment(): 执行评论互动操作。

screen-unlock.js (屏幕解锁)

提供屏幕解锁相关功能:

  • screenUnlock(unlockPassword): 亮屏并解锁设备,支持上划解锁或密码解锁。
  • isScreenLocked(): 检查屏幕是否锁定。
  • passwordUnlock(password): 使用密码解锁屏幕。

swipe.js (滑动操作)

提供基本的滑动操作函数:

  • swipeUp(): 向上滑动。
  • swipeDown(): 向下滑动。
  • swipeLeft(left, top, right, bottom, duration): 向左滑动。
  • swipeRight(left, top, right, bottom, duration): 向右滑动。

使用示例

const { openApp, wait, log } = require("hamibot-lib/index.js");
const { enterVideo, doFavor } = require("hamibot-lib/douyin.js");

// 从抖音个人主页进入第一个视频并点赞
log("脚本开始运行");
openApp("抖音");
wait();
if (enterVideo()) {
  doFavor();
}
log("脚本运行结束");

优秀脚本案例

License

MIT