JAVA——使用Spring Boot Scheduled时注入simple-robot Bot解决方案

Maven 

        love.forte.simple-robotcomponent-mirai-spring-boot-starter1.16.0-preview.3

官方文档 

simple-robot 2.0 bot开发文档

simple-robot 机器人开发者使用文档

解决方案 

package cn.edu.zstu.myzstu.robot.qq.quartz;import cn.edu.zstu.myzstu.robot.qq.service.IHealthDeclarationService;
import com.forte.qqrobot.bot.BotManager;
import com.forte.qqrobot.sender.MsgSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;/*** @Author ShenTuZhiGang* @Version 1.0.0* @Date 2020-07-12 21:18*/
@Component
public class HealthDeclarationWarm{@Autowiredprivate BotManager botManager;//@Override@Scheduled(cron = "0 0 8,9,10,11 * * *")public void execute() {MsgSender sender = botManager.getBot("314").getSender();}
}

参考文章

simple-robot 2.0 bot开发文档

simple-robot 机器人开发者使用文档


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部