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 🙏

© 2026 – Pkg Stats / Ryan Hefner

karin-plugin-timechange

v1.0.0

Published

Karin智能头像切换插件 - 根据时间自动在白天和晚上切换不同的头像

Readme

karin-plugin-timechange

一个用于Karin机器人的智能头像切换插件,可以根据时间自动在白天和晚上切换不同的头像。

功能特性

  • 🌅 智能时间识别:自动识别当前是白天还是晚上
  • 🔄 自动切换头像:定时任务每小时检查并自动切换头像
  • 🎭 手动控制:支持手动切换到指定时段的头像
  • ⚙️ 灵活配置:可自定义白天/晚上的时间段
  • 📁 头像管理:支持通过图片或文件路径设置头像
  • 🌐 网页配置:提供可视化的网页配置界面
  • 🛡️ 权限控制:所有操作仅限机器人主人使用

安装方法

在Karin根目录执行:

# 使用pnpm(推荐)
pnpm add karin-plugin-timechange -w

# 或使用npm
npm install karin-plugin-timechange --workspace

安装完成后重启Karin机器人即可。

快速开始

方式一:直接上传图片(推荐)

#上传头像 白天    # 然后发送白天要用的图片
#上传头像 晚上    # 然后发送晚上要用的图片
#开启自动切换    # 启用定时自动切换功能

方式二:网页配置

  1. 访问Karin网页控制台
  2. 找到"头像自动切换插件"配置页面
  3. 设置头像文件路径或上传图片
  4. 开启自动切换并保存

方式三:文件路径设置

#设置白天头像    # 然后发送图片文件路径
#设置晚上头像    # 然后发送图片文件路径
#开启自动切换    # 启用定时自动切换功能

主要命令

基础控制

  • #头像帮助 - 显示帮助信息
  • #头像状态 - 查看当前配置状态
  • #切换白天头像 - 手动切换到白天头像
  • #切换晚上头像 - 手动切换到晚上头像
  • #自动切换头像 - 根据当前时间自动切换
  • #开启自动切换 - 开启定时自动切换
  • #关闭自动切换 - 关闭定时自动切换
  • #设置时间段 6 18 - 设置时间段

头像管理

  • #上传头像 白天/晚上 - 上传头像(推荐)
  • #头像预览 白天/晚上 - 预览头像
  • #头像信息 - 查看头像文件信息
  • #删除头像 白天/晚上 - 删除头像文件

配置说明

  • 默认时间段:白天 6:00-18:00,晚上 18:00-6:00
  • 支持格式:jpg、png、gif、bmp、webp
  • 文件大小:建议不超过5MB
  • 配置文件@karinjs/karin-plugin-timechange/config/avatar-config.json

工作原理

  1. 时间判断:根据当前小时数和配置的时间段判断是白天还是晚上
  2. 定时检查:每小时执行一次检查,如果当前时段与上次切换的时段不同则进行切换
  3. 头像切换:读取对应时段的头像文件,转换为base64格式后调用Bot API进行切换
  4. 状态记录:记录每次切换的时间和类型,避免重复切换

注意事项

  • 所有命令仅限机器人主人使用
  • 头像文件支持常见图片格式
  • 建议头像文件大小不超过5MB
  • 首次使用需要先设置头像文件路径
  • 自动切换功能需要手动开启

技术特点

  • 基于 Karin 插件开发规范
  • 使用 TypeScript 开发
  • 支持热重载和开发模式
  • 完整的网页配置界面
  • 模块化设计,易于维护

开源协议

MIT License

作者

Eos-Hira

仓库地址

https://github.com/Eos-Hira/karin-plugin-timechange

问题反馈

如果遇到问题,请在 Issues 中反馈。