Skip to content

Commit

Permalink
feat:waifu来喽
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhan258 committed Jul 7, 2023
1 parent 6dfbafa commit 555e107
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 31 deletions.
82 changes: 80 additions & 2 deletions apps/girl.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,93 @@ export class girl extends plugin {
reg: '^#?(小姐姐|xjj)$',
/** 执行方法 */
fnc: 'xjj'
},
{
/** 命令正则匹配 */
reg: '^#?waifu$',
/** 执行方法 */
fnc: 'waifu'
},
{
/** 命令正则匹配 */
reg: '^#?(Girl|girl)$',
/** 执行方法 */
fnc: 'girl'
}
]
})
}

// girl
async girl (e) {
// 发送消息
await this.reply(segment.image('http://api.yujn.cn/api/sjvs.php?'))
return true // 返回true 阻挡消息不再往下
}

// waifu
async waifu (e) {
const apiUrl = 'https://api.waifu.im/search' // Replace with the actual API endpoint URL
let sendmsg = []
const params = {
included_tags: 'waifu',
height: '>=2000'
}

const queryParams = new URLSearchParams(params)
const requestUrl = `${apiUrl}?${queryParams}`

await fetch(requestUrl)
.then(response => {
if (response.ok) {
return response.json()
} else {
throw new Error('接口出错哩')
}
})
.then(data => {
// Process the response data as needed
console.log(data)
console.log(data.images[0].url)
// 发送消息
try {
sendmsg.push(data.images[0].url)
sendmsg.push(segment.image(data.images[0].url))
e.reply(sendmsg)
} catch (err) {
console.log(err)
e.reply(err)
}
})
.catch(error => {
e.reply(error.message)
console.error('An error occurred:', error.message)
})
return true // 返回true 阻挡消息不再往下
}

// 小姐姐
async xjj (e) {
// 发送消息
await this.reply(segment.image('http://api.yujn.cn/api/yangyan.php?'))
const headers = new Headers()
headers.append('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36')

fetch('http://api.yujn.cn/api/yangyan.php', {
headers
})
.then(response => {
if (response.ok) {
console.log('请求成功')
// 发送消息
this.reply(segment.image('http://api.yujn.cn/api/yangyan.php?'))
} else {
throw new Error('接口出错哩')
}
})
.catch(err => {
console.error('发生错误:', err)
e.reply(err)
// 在这里处理错误
})
return true // 返回true 阻挡消息不再往下
}

Expand Down
4 changes: 2 additions & 2 deletions apps/morse.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export class morse extends plugin {
rule: [
{
/** 命令正则匹配 */
reg: '^#?(摩斯|莫斯)加密',
reg: '^#(摩斯|莫斯)加密',
/** 执行方法 */
fnc: 'morseEn'
},
{
/** 命令正则匹配 */
reg: '^#?(摩斯|莫斯)解密',
reg: '^#(摩斯|莫斯)解密',
/** 执行方法 */
fnc: 'morseDe'
}
Expand Down
11 changes: 10 additions & 1 deletion apps/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,17 @@ export class photo extends plugin {

// 随机柴郡
async cj (e) {
let urls = ['http://api.yujn.cn/api/chaijun.php?', 'http://chaijun.avocado.wiki']
const randomIndex = Math.random()
let url
console.log('randomIndex: ' + randomIndex)
if (randomIndex < 0.7) {
url = urls[1] // 返回第一个 URL,概率为 0.7
} else {
url = urls[0] // 返回第二个 URL,概率为 0.3
}
// 发送消息
await this.reply(segment.image('http://api.yujn.cn/api/chaijun.php?'))
await this.reply(segment.image(url))
return true // 返回true 阻挡消息不再往下
}

Expand Down
6 changes: 3 additions & 3 deletions apps/urlandbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ export class urlAndBase extends plugin {
},
{
/** 命令正则匹配 */
reg: '^#?(url|URL)解码',
reg: '^#(url|URL)解码',
/** 执行方法 */
fnc: 'urlDe'
},
{
/** 命令正则匹配 */
reg: '^#?(base64|Base64)编码',
reg: '^#(base64|Base64)编码',
/** 执行方法 */
fnc: 'baseEn'
},
{
/** 命令正则匹配 */
reg: '^#?(base64|Base64)解码',
reg: '^#(base64|Base64)解码',
/** 执行方法 */
fnc: 'baseDe'
}
Expand Down
51 changes: 28 additions & 23 deletions resources/help/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ <h1 style="text-align: center; font-size: 36px; margin-top: 20px;">憨憨帮助<
</div>
</div>
<div class="general-inner">
<div class="general-inner-block">
<div class="general-inner-block-value">
mt
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
手写
Expand All @@ -144,11 +139,6 @@ <h1 style="text-align: center; font-size: 36px; margin-top: 20px;">憨憨帮助<
兽猫酱
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
买家秀
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
随机柴郡
Expand All @@ -169,11 +159,6 @@ <h1 style="text-align: center; font-size: 36px; margin-top: 20px;">憨憨帮助<
每日英语
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
随机ai
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
天气+城市
Expand Down Expand Up @@ -206,7 +191,7 @@ <h1 style="text-align: center; font-size: 36px; margin-top: 20px;">憨憨帮助<
<div class="general-inner">
<div class="general-inner-block">
<div class="general-inner-block-value">
ping ip(域名)
#ping ip(域名)
</div>
</div>
<div class="general-inner-block">
Expand All @@ -216,26 +201,26 @@ <h1 style="text-align: center; font-size: 36px; margin-top: 20px;">憨憨帮助<
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
url编(解)码
#url编(解)码
</div>
<div class="general-inner-block-title">
url编(解)码+内容
#url编(解)码+内容
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
摩斯加(解)密
#摩斯加(解)密
</div>
<div class="general-inner-block-title">
摩斯加(解)密+内容
#摩斯加(解)密+内容
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
base64编(解)码
#base64编(解)码
</div>
<div class="general-inner-block-title">
base64编(解)码+内容
#base64编(解)码+内容
</div>
</div>
</div>
Expand All @@ -248,11 +233,21 @@ <h1 style="text-align: center; font-size: 36px; margin-top: 20px;">憨憨帮助<
</div>
</div>
<div class="general-inner">
<div class="general-inner-block">
<div class="general-inner-block-value">
mt
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
JK
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
girl
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
黑丝
Expand All @@ -267,12 +262,22 @@ <h1 style="text-align: center; font-size: 36px; margin-top: 20px;">憨憨帮助<
<div class="general-inner-block-value">
写真
</div>
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
买家秀
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
小姐姐
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
随机ai
</div>
</div>
<div class="general-inner-block">
<div class="general-inner-block-value">
loli
Expand Down

0 comments on commit 555e107

Please sign in to comment.