diff --git a/src/main/java/com/yutou/qqbot/QQBotApplication.java b/src/main/java/com/yutou/qqbot/QQBotApplication.java index bb796dc..b86c2e4 100644 --- a/src/main/java/com/yutou/qqbot/QQBotApplication.java +++ b/src/main/java/com/yutou/qqbot/QQBotApplication.java @@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication 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) { System.out.println("version = " + version); SpringApplication.run(QQBotApplication.class, args); diff --git a/src/main/java/com/yutou/qqbot/QQBotManager.java b/src/main/java/com/yutou/qqbot/QQBotManager.java index 31b1b60..2e87c7f 100644 --- a/src/main/java/com/yutou/qqbot/QQBotManager.java +++ b/src/main/java/com/yutou/qqbot/QQBotManager.java @@ -4,7 +4,7 @@ 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.OpenDoor; +import com.yutou.qqbot.models.Commands.BTDownload; import com.yutou.qqbot.models.Commands.System.*; import com.yutou.qqbot.models.Model; import com.yutou.qqbot.models.WebSign.Tsdm; @@ -48,7 +48,7 @@ public class QQBotManager { Model.classList.add(BaiduDown.class); Model.classList.add(MiRouter.class); Model.classList.add(GetSeTu.class); - Model.classList.add(OpenDoor.class); + Model.classList.add(BTDownload.class); } private static QQBotManager botManager = null; private Bot bot; diff --git a/src/main/java/com/yutou/qqbot/models/Commands/BTDownload.java b/src/main/java/com/yutou/qqbot/models/Commands/BTDownload.java new file mode 100644 index 0000000..6b44242 --- /dev/null +++ b/src/main/java/com/yutou/qqbot/models/Commands/BTDownload.java @@ -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); + } + } +} diff --git a/src/main/java/com/yutou/qqbot/models/Commands/OpenDoor.java b/src/main/java/com/yutou/qqbot/models/Commands/OpenDoor.java deleted file mode 100644 index 6c2dae6..0000000 --- a/src/main/java/com/yutou/qqbot/models/Commands/OpenDoor.java +++ /dev/null @@ -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); - } - } -} diff --git a/src/main/java/com/yutou/qqbot/models/Model.java b/src/main/java/com/yutou/qqbot/models/Model.java index 4d50cfc..576b825 100644 --- a/src/main/java/com/yutou/qqbot/models/Model.java +++ b/src/main/java/com/yutou/qqbot/models/Model.java @@ -43,7 +43,7 @@ public abstract class Model implements ModelInterface { public static final String BAIDU_DOWN = "!bd"; public static final String ROUTER_ADD = "!添加设备"; public static final String ROUTER_DEL = "!删除设备"; - public static final String DOOR_OPEN = "开门"; + public static final String BT_DOWNLOAD = "下载bt"; }