新增临时磁链下载功能
This commit is contained in:
parent
28d98e573d
commit
f825302b5f
@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class QQBotApplication {
|
public class QQBotApplication {
|
||||||
public static final String version="QQBot v.1.2.9";
|
public static final String version="QQBot v.1.2.10";
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("version = " + version);
|
System.out.println("version = " + version);
|
||||||
SpringApplication.run(QQBotApplication.class, args);
|
SpringApplication.run(QQBotApplication.class, args);
|
||||||
|
@ -4,7 +4,7 @@ import com.yutou.qqbot.Listeners.QQMessageListener;
|
|||||||
import com.yutou.qqbot.models.Animal.TurnipProphet;
|
import com.yutou.qqbot.models.Animal.TurnipProphet;
|
||||||
import com.yutou.qqbot.models.Commands.BaiduDown;
|
import com.yutou.qqbot.models.Commands.BaiduDown;
|
||||||
import com.yutou.qqbot.models.Commands.Bangumi;
|
import com.yutou.qqbot.models.Commands.Bangumi;
|
||||||
import com.yutou.qqbot.models.Commands.OpenDoor;
|
import com.yutou.qqbot.models.Commands.BTDownload;
|
||||||
import com.yutou.qqbot.models.Commands.System.*;
|
import com.yutou.qqbot.models.Commands.System.*;
|
||||||
import com.yutou.qqbot.models.Model;
|
import com.yutou.qqbot.models.Model;
|
||||||
import com.yutou.qqbot.models.WebSign.Tsdm;
|
import com.yutou.qqbot.models.WebSign.Tsdm;
|
||||||
@ -48,7 +48,7 @@ public class QQBotManager {
|
|||||||
Model.classList.add(BaiduDown.class);
|
Model.classList.add(BaiduDown.class);
|
||||||
Model.classList.add(MiRouter.class);
|
Model.classList.add(MiRouter.class);
|
||||||
Model.classList.add(GetSeTu.class);
|
Model.classList.add(GetSeTu.class);
|
||||||
Model.classList.add(OpenDoor.class);
|
Model.classList.add(BTDownload.class);
|
||||||
}
|
}
|
||||||
private static QQBotManager botManager = null;
|
private static QQBotManager botManager = null;
|
||||||
private Bot bot;
|
private Bot bot;
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
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 net.mamoe.mirai.event.events.MessageEvent;
|
||||||
|
|
||||||
|
public class BTDownload extends Model {
|
||||||
|
private static final String DownloadHomePath="/media/yutou/disk_lvm/public/download/";
|
||||||
|
@Override
|
||||||
|
public boolean isUserPublic() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getUsePowers() {
|
||||||
|
return new String[]{
|
||||||
|
QQFromCommands.BT_DOWNLOAD
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
|
||||||
|
super.onMessage(qq, event, isGroup);
|
||||||
|
if(msg.startsWith("magnet:?xt=")){
|
||||||
|
String builder = "已添加下载磁链" ;
|
||||||
|
QQBotManager.getInstance().sendMessage(qq, builder);
|
||||||
|
String exec = String.format("transmission-remote -n yutou:34864394 -w %sdownload_tmp/%s -a \"%s\" "
|
||||||
|
,DownloadHomePath
|
||||||
|
, AppTools.getToDayTime()
|
||||||
|
, msg
|
||||||
|
);
|
||||||
|
AppTools.exec(exec, new ObjectInterface() {
|
||||||
|
@Override
|
||||||
|
public void out(String data) {
|
||||||
|
super.out(data);
|
||||||
|
}
|
||||||
|
},true,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +0,0 @@
|
|||||||
package com.yutou.qqbot.models.Commands;
|
|
||||||
|
|
||||||
import com.yutou.qqbot.QQBotManager;
|
|
||||||
import com.yutou.qqbot.models.Model;
|
|
||||||
import net.mamoe.mirai.event.events.MessageEvent;
|
|
||||||
|
|
||||||
public class OpenDoor extends Model {
|
|
||||||
@Override
|
|
||||||
public boolean isUserPublic() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getUsePowers() {
|
|
||||||
return new String[]{
|
|
||||||
QQFromCommands.DOOR_OPEN
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
|
|
||||||
super.onMessage(qq, event, isGroup);
|
|
||||||
if(msg.equals(QQFromCommands.DOOR_OPEN)){
|
|
||||||
String builder = "点击该链接开门:" + "\n" +
|
|
||||||
"http://192.168.31.88:802/openDoor.html";
|
|
||||||
QQBotManager.getInstance().sendMessage(qq, builder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -43,7 +43,7 @@ public abstract class Model implements ModelInterface {
|
|||||||
public static final String BAIDU_DOWN = "!bd";
|
public static final String BAIDU_DOWN = "!bd";
|
||||||
public static final String ROUTER_ADD = "!添加设备";
|
public static final String ROUTER_ADD = "!添加设备";
|
||||||
public static final String ROUTER_DEL = "!删除设备";
|
public static final String ROUTER_DEL = "!删除设备";
|
||||||
public static final String DOOR_OPEN = "开门";
|
public static final String BT_DOWNLOAD = "下载bt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user