Git Product home page Git Product logo

koishi-plugin-sleep-manage's Introduction

koishi logo

Koishi Plugin: Sleep-Manage

🎈 Manage your sleep time with Koishi Bot! 🎈

npm Rating

📦Installsation

In Koishi console WebUI or Koishi Desktop App:

  • open the Plugin Market and search for sleep-manage.
  • click the Add button of the first one.
  • Congratulation! You can now click the Enable button of the config page and voilà!

Or in your terminal:

yarn add koishi-plugin-sleep-manage
# or use npm:
npm i koishi-plugin-sleep-manage
## or use koishi desktop terminal(unsafe, may cause you can't get help from the qq group):
koi yarn -n default add koishi-plugin-sleep-manage

🎮Usage

Just like communicating with a human, say hello to the Bot!

Triggers

  • 早安 - Say good morning to the Bot indicating that you are awake.
  • 晚安 - Say good night to the Bot indicating that you are asleep.

You can also use other words as triggers, there are several related configuration in the config page of the plugin.

Commands

sleep - Show the command helper.

sleep.timezone - Set your own timezone instead of the default one. (e.g. +8 for UTC +0800)

(WIP) sleep.sleep - Set the time for bed. (e.g. 23:00) if you are still chating, the bot will remind you to go to bed.

sleep.auto - Set whether to automatically regard your first message in a day as the good morning trigger.

sleep.week - Show your weekly report for your sleep.

sleep.month - Show your monthly report for your sleep.

sleep.year - Show your yearly report for your sleep.

🔧 Config

  • kuchiguse : Suffix phrase adding to every sentence the Bot saying.
  • command: Prefix for every commands, default is sleep.
  • timezone : Default timezone.
  • interval : Set amount of time to supress trigger greetings.
  • firstMorning: Set whether to automatically regard everyone's first message in a day as the good morning trigger.
  • multiTrigger: Set whether to respond user triggers multiple times in interval amount of time.
  • morningSpan: Morning trigger time span.
  • eveningSpan: Evening trigger time span.
  • morningWord: Response word of morning.
  • eveningWord: Response word of evening.

🥰 Thanks

JetBrains Logo (Main) logo.

Thanks to JetBrains for supporting my open source project!

Contributors

Star History Chart

📄 License

The project is licensed under the MIT License.

koishi-plugin-sleep-manage's People

Contributors

lipraty avatar maikotan avatar mirrorcy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

koishi-plugin-sleep-manage's Issues

Plan: 2.0.0

Bugfix

  • 消息未响应 (#7)
  • 重复播报的排名 (#6)
  • 开启 morning 时未正确响应当天第一条消息 (#6)
  • 睡眠时长未计算 (#6)

Refactor

  • 指令化响应
  • 加入中间件-指令模式
  • 重构数据库结构
  • 全局 / 频道 / 群组 / 用户 逐级时区配置
  • 加入指令

Feature: 一些想法

一、增加数据统计

  1. 可以让bot统计用户这个月平均睡眠时间,并使用指令查看,增加用户按时发早安晚安的动力。例如:
    #睡眠时间记录:
  • 本月你共睡眠144小时,平均睡眠时间12小时,你是猪吗这么能睡!
  • 本月你共睡眠48小时,平均睡眠时间4小时,快睡觉啦小心猝死!
    延伸:每个人可以设置自己的最迟睡觉时间#开启晚安提示(也可以是平均记录的n小时后?),超出这个时间如果没有发晚安,则bot自动艾特他并发送“快睡觉啦小心猝死!”。
  1. 睡眠时间排名,虽然我不知道有没有意义(?)

二、简化流程,增加只发送晚安,自动侦测早安的开关(总开关/各群独立皆可)

逻辑思路例如:发送晚安后自动侦测下一条任意消息记录,若为1小时内则刷新时间记录,直到下一条消息间隔为3小时以上(不要求为早安),bot发送“早安!你的睡眠时间是10小时10分钟,你是今天第10个起床的”。

三、增加更多匹配词(配置项(总开关/各群独立皆可))

例如(以下皆摘自atri):
"早安", "早哇", "早上好", "ohayo", "哦哈哟", "お早う", "早好", "早", "早早早"匹配早安;
"晚安", "oyasuminasai", "おやすみなさい", "晚好", "晚上好"匹配晚安。

延伸:在响应早安晚安时可以输出一些根据时间的随机文案。
例如(以下改自atri):
“啊......早上好...(哈欠),今天你睡了6小时6分钟,呼啊啊~~~~再多睡会儿吧~”
“早个啥?今天你睡了12小时,你是猪吗这么能睡!哼!我都准备洗洗睡了!”
虽然这么写的话较难配置(当前时间前缀+睡眠时间匹配文案+当前时间后缀),总之提供一个思路,具体实现加油(

四、配置时区

用户可以设定自己的时区,来调整睡眠统计响应时间的偏移值。


以上都是个人想法举例,随意更改,加油!

还是不会用这个插件,感觉启用了没什么改变

Bugs: 一些bugs

image
这张图汇聚了两个bug,一个是时区不生效,另一个是排名反复播报。

  1. 时区方面你已经选择了下个版本弃用,暂且不谈。
  2. 排名更新理应在当且仅当排名变动时播报,而不是一直播报。但这会涉及到另一个问题,如果两个人晚安后聊天,将会反复触发排名变动而无限播报。所以我认为下个版本中你可以同时弃用排名变动后的播报。

image
这张图也同样汇聚了两个bug,一个是automorning错误响应,一个是睡眠时间未统计。

  1. 根据我的消息记录,群友未在前一天发言,但触发了automorning,当然不排除我丢消息的可能。
  2. 睡眠时间未统计,正常应当有提示但很多时候没有。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.