package org.jebot.rest;

import org.jebot.config.BotConfig;
import org.jebot.handler.HandlerManager;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BotRest {

    private final BotConfig botConfig;
    private final HandlerManager handlerManager;

    public BotRest(BotConfig botConfig, HandlerManager handlerManager) {
        this.botConfig = botConfig;
        this.handlerManager = handlerManager;
    }

    @GetMapping("/reload-bot")
    public String reloadBot(@RequestParam String newToken) {
        botConfig.reloadBot(newToken, handlerManager);
        return "TelegramBot 已成功重载";
    }

}




