新增同步百度云功能
This commit is contained in:
parent
90b9718471
commit
191a1fc6ed
@ -2,6 +2,7 @@ package com.yutou.qqbot;
|
||||
|
||||
import com.yutou.qqbot.Listeners.QQMessageListener;
|
||||
import com.yutou.qqbot.models.Animal.TurnipProphet;
|
||||
import com.yutou.qqbot.models.Commands.BaiduDown;
|
||||
import com.yutou.qqbot.models.Commands.Bangumi;
|
||||
import com.yutou.qqbot.models.Commands.System.*;
|
||||
import com.yutou.qqbot.models.Commands.Tsdm;
|
||||
@ -40,6 +41,7 @@ public class QQBotManager {
|
||||
|
||||
Model.classList.add(TurnipProphet.class);
|
||||
Model.classList.add(Tsdm.class);
|
||||
Model.classList.add(BaiduDown.class);
|
||||
}
|
||||
private static QQBotManager botManager = null;
|
||||
private Bot bot;
|
||||
|
40
src/main/java/com/yutou/qqbot/models/Commands/BaiduDown.java
Normal file
40
src/main/java/com/yutou/qqbot/models/Commands/BaiduDown.java
Normal file
@ -0,0 +1,40 @@
|
||||
package com.yutou.qqbot.models.Commands;
|
||||
|
||||
import com.yutou.qqbot.QQBotManager;
|
||||
import com.yutou.qqbot.interfaces.ObjectInterface;
|
||||
import com.yutou.qqbot.models.Model;
|
||||
import com.yutou.qqbot.utlis.AppTools;
|
||||
import com.yutou.qqbot.utlis.Log;
|
||||
import net.mamoe.mirai.event.events.MessageEvent;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class BaiduDown extends Model {
|
||||
@Override
|
||||
public boolean isUserPublic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getUsePowers() {
|
||||
return new String[]{
|
||||
QQFromCommands.BAIDU_DOWN
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
|
||||
super.onMessage(qq, event, isGroup);
|
||||
if(msg.startsWith(QQFromCommands.BAIDU_DOWN)){
|
||||
QQBotManager.getInstance().sendMessage(qq,"开始同步百度云");
|
||||
AppTools.exec("cd "+new File("baidupan").getAbsolutePath()+" && bypy downdir -v", new ObjectInterface() {
|
||||
@Override
|
||||
public void out(String data) {
|
||||
super.out(data);
|
||||
Log.i(data);
|
||||
QQBotManager.getInstance().sendMessage(qq,"任务完成");
|
||||
}
|
||||
},true,true);
|
||||
}
|
||||
}
|
||||
}
|
@ -38,6 +38,7 @@ public abstract class Model implements ModelInterface {
|
||||
public static final String TURNIP_PROPHET = "大头菜";
|
||||
public static final String TSDM_PAY = "!tsdm";
|
||||
public static final String TSDM_SIGN = "!tsdm签到";
|
||||
public static final String BAIDU_DOWN = "!bd";
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user