mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: 增加摸鱼人日历
1. 更改README.md 2. 修复一些问题 3. 增加每日推送
This commit is contained in:
parent
f8cb4f0234
commit
f55033a20c
@ -28,10 +28,9 @@ index -- 主入口
|
||||
> linux系统下自己装一个mongodb,上一个密码(不上有风险)
|
||||
2. `test -- main.py`爬取链接(要有python环境、配合mongodb使用)
|
||||
> python3 main.py
|
||||
4. 在`Yunzai-Bot`安装mongodb、axios(0.27.2)依赖
|
||||
> pnpm add mongodb -w
|
||||
4. 在`Yunzai-Bot`安装mongodb、axios(0.27.2)、代理工具(tunnel)、TwitterAPI依赖
|
||||
> pnpm add mongodb axios tunnel twitter-api-v2 -w
|
||||
|
||||
> pnpm add axios -w
|
||||
4. 下载插件
|
||||
> git clone https://gitee.com/kyrzy0416/rconsole-plugin.git ./plugins/rconsole-plugin/
|
||||
|
||||
|
@ -22,6 +22,7 @@ function autoTask (func, time) {
|
||||
|
||||
// 定时任务合集
|
||||
autoTask(pushDailyWorld, '0 30 8 * * ?')
|
||||
autoTask(pushTouchFish, '0 31 8 * * ?')
|
||||
|
||||
export class daily extends plugin {
|
||||
constructor (e) {
|
||||
@ -33,7 +34,11 @@ export class daily extends plugin {
|
||||
rule: [
|
||||
{
|
||||
reg: '^#每天60秒$',
|
||||
fnc: 'pushDailyWorld'
|
||||
fnc: 'dailyWorld'
|
||||
},
|
||||
{
|
||||
reg: '^#摸鱼人日历$',
|
||||
fnc: 'touchFish'
|
||||
},
|
||||
{
|
||||
reg: '^#开关每日推送$',
|
||||
@ -45,8 +50,13 @@ export class daily extends plugin {
|
||||
|
||||
async dailyWorld (e) {
|
||||
// 定时发送时间,采用 Cron 表达式,当前默认为每日 8:30 分推送
|
||||
await pushDailyWorld(e)
|
||||
return true
|
||||
await pushDailyWorld(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
async touchFish (e) {
|
||||
await pushTouchFish(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
async shutdown (e) {
|
||||
@ -61,10 +71,10 @@ export class daily extends plugin {
|
||||
*/
|
||||
async function pushDailyWorld (e) {
|
||||
// 每天60秒读懂世界接口地址
|
||||
const url = await fetch('http://bjb.yunwj.top/php/tp/lj.php')
|
||||
const url = await fetch('https://api.vvhan.com/api/60s?type=json')
|
||||
.catch(err => logger.error(err))
|
||||
const imgUrl = await url.json()
|
||||
const res = await imgUrl.tp
|
||||
const res = await imgUrl.imgUrl
|
||||
|
||||
// 判断接口是否请求成功
|
||||
if (!res) {
|
||||
@ -78,3 +88,22 @@ async function pushDailyWorld (e) {
|
||||
e.reply(segment.image(res))
|
||||
}
|
||||
}
|
||||
|
||||
async function pushTouchFish (e) {
|
||||
const url = await fetch('https://api.vvhan.com/api/moyu?type=json')
|
||||
.catch(err => logger.error(err))
|
||||
const imgUrl = await url.json()
|
||||
const res = await imgUrl.url
|
||||
|
||||
// 判断接口是否请求成功
|
||||
if (!res) {
|
||||
e.reply('[摸鱼人日历] 接口请求失败')
|
||||
}
|
||||
|
||||
// 回复消息
|
||||
if (e instanceof Group) {
|
||||
e.sendMsg(segment.image(res))
|
||||
} else {
|
||||
e.reply(segment.image(res))
|
||||
}
|
||||
}
|
@ -252,13 +252,16 @@ export class tools extends plugin {
|
||||
e.reply(`识别:腿忒学习版,${resp.data.text}`)
|
||||
const downloadPath = `${ this.defaultPath }${ this.e.group_id || this.e.user_id }`;
|
||||
if (resp.includes.media[0].type === 'photo') {
|
||||
// 目前解决方案:express建立本地请求,然后segment.image,但是要引入express
|
||||
e.reply("目前想到的解决方案较为复杂,待解决!");
|
||||
return true;
|
||||
// 图片
|
||||
resp.includes.media.map(item => {
|
||||
const filePath = `${downloadPath}/${item.url.split('/').pop()}`
|
||||
this.downloadImgs(item.url, downloadPath).then(res => {
|
||||
e.reply([segment.image(filePath)])
|
||||
})
|
||||
})
|
||||
// resp.includes.media.map(item => {
|
||||
// const filePath = `${downloadPath}/${item.url.split('/').pop()}`
|
||||
// this.downloadImgs(item.url, downloadPath).then(res => {
|
||||
// e.reply([segment.image(filePath)])
|
||||
// })
|
||||
// })
|
||||
} else {
|
||||
// 视频
|
||||
this.downloadVideo(resp.includes.media[0].variants[0].url, true).then(video => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user