1、前言
正常人每天平均耗水量为2000-2500毫升,体内物质氧化可生水300毫升,故每日应补充水分2200毫升,包括饮食中的含水量。夏天每日补充水分在3000毫升左右,才能满足人体需要。
如果有个机器人能按时提醒我们喝水,那该多好啊~~
2、创建一个springboot项目
(这个步骤是为小白提供,大佬们直接跳到第三步)
2.1.新建项目
2.2.选择springboot项目
2.3.创建完成的项目结构如下
3、引入simple-robot机器人依赖
3.1.在pom.xml文件引入simple-robot依赖
<properties> <java.version>1.8</java.version> <simbot.version>2.0.3</simbot.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>love.forte.simple-robot</groupId> <artifactId>parent</artifactId> <version>${simbot.version}</version> <scope>import</scope> <type>pom</type> </dependency> </dependencies> </dependencyManagement>
<!--java机器人框架--> <dependency> <groupId>love.forte.simple-robot</groupId> <artifactId>component-mirai-spring-boot-starter</artifactId> </dependency>
3.2.配置application.yml文件,使用ANDROID_PAD协议可以保持手机QQ和机器人同时在线
simbot: core: # 机器人的QQ账号与密码(帐号:密码) bots: 6013505:yinfeng component: mirai: # mirai心跳周期. 过长会导致被服务器断开连接. 单位毫秒。 heartbeat-period-millis: 30000 # 每次心跳时等待结果的时间.一旦心跳超时, 整个网络服务将会重启 (将消耗约 1s). 除正在进行的任务 (如图片上传) 会被中断外, 事件和插件均不受影响. heartbeat-timeout-millis: 5000 # 心跳失败后的第一次重连前的等待时间. first-reconnect-delay-millis: 5000 # 重连失败后, 继续尝试的每次等待时间 reconnect-period-millis: 5000 # 最多尝试多少次重连 reconnection-retry-times: 2147483647 # 使用协议类型。注,此值为枚举类 net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol 的元素值, # 可选值为:ANDROID_PHONE、ANDROID_PAD、ANDROID_WATCH protocol: ANDROID_PAD # 是否关闭mirai的bot logger no-bot-log: true # 关闭mirai网络日志 no-network-log: true # mirai bot log切换使用simbot的log use-simbot-bot-log: true # mirai 网络log 切换使用simbot的log use-simbot-network-