ChopperBot ChopperBot
首页
  • 快速开始
  • 开发指南
  • 技术文档
  • 使用配置
生态
问答
💖支持
🚀起飞诶~~起飞
更新日志 (opens new window)
GitHub (opens new window)
首页
  • 快速开始
  • 开发指南
  • 技术文档
  • 使用配置
生态
问答
💖支持
🚀起飞诶~~起飞
更新日志 (opens new window)
GitHub (opens new window)
  • 模块文档

    • common

      • common目录
        • ConfigFile
          • 构造ConfigFile
        • InitMachine🚧
          • 初始化启动
    • FileModule

      • FileModule目录
      • FileCache
    • BarrageModule

    • AccountModule

    • CreeperModule

    • HotModule

  • 技术文档
  • 模块文档
  • common
Genius
2023-05-19
目录

common目录

👉 源码 (opens new window)

  • ConfigFile
    • 构造ConfigFile
  • InitMachine🚧
    • 初始化启动

# ConfigFile

说明

所有的配置文件抽象类,只负责构建配置文件最基础的架构,一般不用来存放配置文件本身的内容,
包含更新时间和data数据,最基本的文件格式如下

{
  "updateTime": "最新更新时间",
  "data": {}
}
1
2
3
4

# 构造ConfigFile

  1. 继承ConfigFile,并选择configFile的data内容
  2. 构造方法中使用super() 来构造父类
构造方法参数 说明
filePath 文件路径
fileName 文件名
data 文件骨架
fileType 文件类型
public class HelloConfigFile extends ConfigFile<Map> {
    public ModuleSrcConfigFile() {
        super("./config/"
                , "helloConfig.json"
                , new HashMap(), FileType.CHOPPER_BOT);
    }
}
1
2
3
4
5
6
7

# InitMachine🚧

说明

项目初始化接口,负责项目一开始就进行的初始化工作,之后可能会用@Configruation替代

# 初始化启动

  1. 实现InitMachine接口
public class FileCacheManagerInit implements InitMachine{

    @Override
    public boolean init() {
        FileCacheManagerInstance.getInstance().start();
        return true;
    }
}
1
2
3
4
5
6
7
8
  1. 添加到InitWorld中(Console/ConsoleApplication)
 public static boolean Init(){
        return InitWorld.getInstance()
                .setInitMachines(
                        List.of(
                        new ModuleSrcConfigFileInit(),
                        new FileCacheManagerInit()
                        )
                ).start();
    }
1
2
3
4
5
6
7
8
9
帮助我们改善此页面! (opens new window)
上次更新: 2023/07/31, 18:39:11
FileModule目录

FileModule目录→

Theme by Vdoing | Copyright © 2016-2023 TimeMachine Lab | Sponsored by JetBrains | 渝ICP备2021000141号-1

友情链接:GeniusBlog

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式