Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提问:如何通过BotBuilder阻止将日志发送至后台 #86

Closed
TUCAOEVER opened this issue Aug 14, 2024 · 1 comment
Closed

提问:如何通过BotBuilder阻止将日志发送至后台 #86

TUCAOEVER opened this issue Aug 14, 2024 · 1 comment
Labels
question 对错误或其它问题进行提问

Comments

@TUCAOEVER
Copy link

问题描述

使用Overflow进行二次开发时,使用BotBuilder构建机器人,机器人相关日志会被输出至控制台
此前使用 Mirai 时可以通过 BotConfiguration 中的 noBotLog() 来阻止控制台信息,咨询 Overflow 是否存在相关方法?
如若没有,是否可以添加此方法。

private void connect() {
        switch (getConfig().getString("type", "none")) {
            case "positive": {
                bot = BotBuilder.positive(getConfig().getString("host"))
                        .token(getConfig().getString("token"))
                        .retryTimes(0)
                        .overrideLogger(getSLF4JLogger())
                        .connect();
                break;
            }
            case "reversed": {
                bot = BotBuilder.reversed(getConfig().getInt("port"))
                        .token(getConfig().getString("token"))
                        .retryTimes(0)
                        .connect();
                break;
            }
            case "none": {
                getLogger().severe("Please check config file.");
            }
        }
    }

复现

private void connect() {
        switch (getConfig().getString("type", "none")) {
            case "positive": {
                bot = BotBuilder.positive(getConfig().getString("host"))
                        .token(getConfig().getString("token"))
                        .retryTimes(0)
                        .overrideLogger(getSLF4JLogger())
                        .connect();
                break;
            }
            case "reversed": {
                bot = BotBuilder.reversed(getConfig().getInt("port"))
                        .token(getConfig().getString("token"))
                        .retryTimes(0)
                        .connect();
                break;
            }
            case "none": {
                getLogger().severe("Please check config file.");
            }
        }
    }

QQ_1723604635554

Overflow 版本

76247fb

其他组件版本

No response

系统日志

No response

网络日志

No response

补充信息

No response

@TUCAOEVER TUCAOEVER added the question 对错误或其它问题进行提问 label Aug 14, 2024
@MrXiaoM
Copy link
Owner

MrXiaoM commented Aug 14, 2024

更新了,现在可以设定 BotConfiguration 了
由于不能提前知道QQ号,设置工作目录不方便,还加了一个用法为 .workingDir(qq -> new File("bots/" + qq)) 的方法便于设置工作目录

@MrXiaoM MrXiaoM closed this as completed Aug 17, 2024
@MrXiaoM MrXiaoM pinned this issue Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question 对错误或其它问题进行提问
Projects
None yet
Development

No branches or pull requests

2 participants