优化B站直播间每日签到提示文本

This commit is contained in:
Yutousama 2023-01-07 10:22:57 +08:00
parent 3bc4c164e0
commit 943a2c9334
4 changed files with 27 additions and 12 deletions

View File

@ -18,6 +18,17 @@ public class AppUserTask {
private long weekGroup;
private DayTask dayTask;
public static String toMessageFormat(AppUserTask oldTask, AppUserTask newTask) {
StringBuilder sb = new StringBuilder();
sb.append("当前电池数量:").append(String.format("%.2f → %.2f",
(double) oldTask.wallet.gold / 100,
(double) newTask.wallet.gold / 100)
).append("\n");
sb.append("当前银瓜子数量:").append(newTask.wallet.silver).append("\n");
sb.append("每日领取电池:").append(newTask.dayTask.toMessageFormat()).append("\n");
newTask.weekTask.forEach(task -> sb.append(task.toMessageFormat(newTask.weekTotal)).append("\n"));
return sb.toString();
}
public String toMessageFormat() {
StringBuilder sb = new StringBuilder();

View File

@ -13,8 +13,8 @@ import java.util.Timer;
import java.util.TimerTask;
public class BiliBiliManga {
public BiliBiliManga() {
biliUtils = BiliBiliUtils.getInstance(QQBotManager.defQQ);
public BiliBiliManga(long qq) {
biliUtils = BiliBiliUtils.getInstance(qq);
}
public static JSONObject sign() {

View File

@ -66,9 +66,11 @@ public class BiliBiliLive extends Model {
builder.append("BiliLiveSign").append(id).append(":").append(sign).append("\n");
}
QQBotManager.getInstance().sendMessage(sendQQ, builder.toString());
AppUserTask task = new BiliBiliAppUtils(QQBotManager.defQQ).startAppTask();
BiliBiliAppUtils appUtils = new BiliBiliAppUtils(QQBotManager.defQQ);
AppUserTask oldTask = appUtils.startAppTask();
AppUserTask newTask = appUtils.getTaskProgress();
builder = new StringBuilder();
builder.append("执行APP任务").append("\n").append(task.toMessageFormat());
builder.append("执行APP任务").append("\n").append(AppUserTask.toMessageFormat(oldTask, newTask));
QQBotManager.getInstance().sendMessage(sendQQ, builder.toString());
}

View File

@ -10,6 +10,7 @@ import com.yutou.qqbot.utlis.QRCodeUtils;
import net.mamoe.mirai.event.events.MessageEvent;
import java.io.File;
@UseModel
public class BiliBiliMangeSign extends Model {
@Override
@ -34,6 +35,7 @@ public class BiliBiliMangeSign extends Model {
@Override
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
super.onMessage(qq, event, isGroup);
BiliBiliManga manga = new BiliBiliManga(user);
if (msg.equals(QQFromCommands.BILI_MANGA_SIGN)) {
String msg;
if (new BiliLogin(user).testLogin()) {
@ -70,7 +72,7 @@ public class BiliBiliMangeSign extends Model {
}
QQBotManager.getInstance().sendMessage(qq, builder.toString());
} else if (msg.equals(QQFromCommands.BILI_MANGA_PAY_STOP)) {
new BiliBiliManga().stopPayMission();
manga.stopPayMission();
QQBotManager.getInstance().sendMessage(qq, "当前任务已取消:" + BiliBiliManga.getMission());
} else if (msg.startsWith(QQFromCommands.BILI_MANGA_PAY)) {
msg = msg.replace(QQFromCommands.BILI_MANGA_PAY, "");
@ -97,7 +99,7 @@ public class BiliBiliMangeSign extends Model {
QQBotManager.getInstance().sendMessage(qq, "商城id错误");
return;
}
BiliBiliManga manga = new BiliBiliManga();
manga.addInterface(new ObjectInterface() {
@Override
public void out(String data) {