diff --git a/config/config.json b/config/config.json index 6a44b89..ec6a13e 100644 --- a/config/config.json +++ b/config/config.json @@ -1,5 +1,6 @@ { "debug": true, "core": true, - "maxFeed": 10 + "maxFeed": 10, + "adapter": "lgr" } diff --git a/config/feeds.json b/config/feeds.json index 3eb5adb..fe51488 100644 --- a/config/feeds.json +++ b/config/feeds.json @@ -1,7 +1 @@ -[ - { - "url": "", - "targetGroups": [114,154], - "screenshot": true - } -] +[] diff --git a/lib/yunzai/group.js b/lib/yunzai/group.js new file mode 100644 index 0000000..5a96950 --- /dev/null +++ b/lib/yunzai/group.js @@ -0,0 +1,16 @@ +import ConfigControl from '../config/configControl.js'; + +class NapcatGroup {} +class LgrGroup {} + +async function getGroupAdapter() { + const adapter = (await ConfigControl.get('config'))?.adapter; + if (!adapter || adapter === 'nc' || adapter === 'napcat') { + return new NapcatGroup(); + } else if (adapter === 'lgr' || adapter === 'lagrange') { + return new LgrGroup(); + } + return new NapcatGroup(); +} + +export default await getGroupAdapter(); diff --git a/lib/yunzai/message.js b/lib/yunzai/message.js new file mode 100644 index 0000000..798e1dd --- /dev/null +++ b/lib/yunzai/message.js @@ -0,0 +1,16 @@ +import ConfigControl from '../config/configControl.js'; + +class NapcatMessage {} +class LgrMessage {} + +async function getMessageAdapter() { + const adapter = (await ConfigControl.get('config'))?.adapter; + if (!adapter || adapter === 'nc' || adapter === 'napcat') { + return new NapcatMessage(); + } else if (adapter === 'lgr' || adapter === 'lagrange') { + return new LgrMessage(); + } + return new NapcatMessage(); +} + +export default await getMessageAdapter(); diff --git a/lib/yunzai/self.js b/lib/yunzai/self.js new file mode 100644 index 0000000..8cca86a --- /dev/null +++ b/lib/yunzai/self.js @@ -0,0 +1,16 @@ +import ConfigControl from '../config/configControl.js'; + +class NapcatSelf {} +class LgrSelf {} + +async function getSelfAdapter() { + const adapter = (await ConfigControl.get('config'))?.adapter; + if (!adapter || adapter === 'nc' || adapter === 'napcat') { + return new NapcatSelf(); + } else if (adapter === 'lgr' || adapter === 'lagrange') { + return new LgrSelf(); + } + return new NapcatSelf(); +} + +export default await getSelfAdapter();