Skip to content

Commit

Permalink
feat:下架一些没用的功能,有啥想加的功能可以提issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhan258 committed Aug 4, 2023
1 parent 2c8fa30 commit 07769b2
Show file tree
Hide file tree
Showing 21 changed files with 475 additions and 489 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 1.2.2
* 下架一些没用的功能,有啥想加的功能可以提issue
# 1.2.1
* 加载日志显示版本号
# 1.1.4
Expand Down
14 changes: 6 additions & 8 deletions apps/els.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ export class RussiaRoundPlatePlugin extends plugin {
{
reg: '^#?结束游戏$',
fnc: 'stopShoop'
},{
}, {
reg: '^#?当前子弹$',
fnc: 'nowBullet'
}
]
})
}



async start (e) {
if (!e.isGroup) {
Expand Down Expand Up @@ -68,7 +66,7 @@ export class RussiaRoundPlatePlugin extends plugin {
await e.reply(`【${username}】开了一枪,枪响了。\n恭喜【${username}】被禁言${time}秒\n本轮游戏结束。请使用#开盘 开启新一轮游戏`)
await redis.del(`HANHAN:ELS:${groupId}`)
} else {
leftBullets--
leftBullets--
await redis.set(`HANHAN:ELS:${groupId}`, leftBullets + '', { EX: 10 * 60 * 1000 })
await e.reply(`【${username}】开了一枪,没响。\n还剩【${leftBullets}】发子弹`)
// e.reply(`${leftBullets}`)
Expand All @@ -85,13 +83,13 @@ export class RussiaRoundPlatePlugin extends plugin {
// e.reply(groupLock)
if (!groupLock) {
e.reply('当前群没有开盘')
}else{
} else {
await redis.del(`HANHAN:ELS:${groupId}`)
e.reply('结束成功')
}
}

async nowBullet(e){
async nowBullet (e) {
if (!e.isGroup) {
await e.reply('当前不在群聊里')
return false
Expand All @@ -100,8 +98,8 @@ export class RussiaRoundPlatePlugin extends plugin {
let groupLock = await redis.get(`HANHAN:ELS:${groupId}`)
if (!groupLock) {
e.reply('当前群没有开盘')
}else{
e.reply('当前还有'+ groupLock + '发子弹')
} else {
e.reply('当前还有' + groupLock + '发子弹')
}
}
}
5 changes: 3 additions & 2 deletions apps/girl.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@ export class girl extends plugin {
// 黑丝
async hs (e) {
// 发送消息
// http://api.yujn.cn/api/heisi.php?
await this.reply(segment.image('http://shanhe.kim/api/tu/hs.php'))
// http://api.tombk.cn/API/hs/hs.php
await this.reply(segment.image('http://api.yujn.cn/api/heisi.php?'))
return true // 返回true 阻挡消息不再往下
}

// 白丝
async bs (e) {
// 发送消息
// http://api.tombk.cn/API/bs/bs.php
await this.reply(segment.image('http://api.yujn.cn/api/baisi.php?'))
return true // 返回true 阻挡消息不再往下
}
Expand Down
4 changes: 2 additions & 2 deletions apps/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class help extends plugin {

async so_help (e) {
/** e.msg 用户的命令消息 */
logger.info('[用户命令]', e.msg)
await e.runtime.render('hanhan-plugin', '/help/sys.html')
logger.info('[用户命令]', e.msg)
await e.runtime.render('hanhan-plugin', '/help/sys.html')
}
}
152 changes: 62 additions & 90 deletions apps/json.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,68 @@
import fs from 'fs'
import { segment } from 'icqq'
// import fs from 'fs'
// import { segment } from 'icqq'

const RootPath = process.cwd() + '/plugins/hanhan-plugin/'
// const RootPath = process.cwd() + '/plugins/hanhan-plugin/'
export default class json extends plugin {
constructor() {
super({
name: '憨憨卡片',
priority: 50,
rule: [
{
reg: '#发红包$',
fnc: 'hb'
},
{
reg: '#fuck$',
fnc: 'fuck'
},
{
reg: '#卡片黑丝$',
fnc: 'mv'
},
{
reg: `#发送(.*)到`,
fnc: 'sendMsdTOTargetGroup'
},
{
reg: "^#(发送)json(消息|信息)?([\\s\\S]*)$",
fnc: 'sendJson'
}
],
})
}

async sendJson(e) {
let messag = e.msg;
messag = messag.replace('#发送json', '')
messag = messag.replace('消息', '')
messag = messag.replace('信息', '')
if (!messag) return;
logger.info(messag)
let msg = [{ type: 'json', data: `${messag}` }]
this.reply(msg)
return true;
}

async hb(e) {
let json = this.getFileDataToJson('/resources/json/QQjson.json')['红包']
e.reply(segment.json(JSON.stringify(json)))
}

async mv(e) {
let json = this.getFileDataToJson('/resources/json/QQjson.json')['卡片黑丝']
e.reply(segment.json(JSON.stringify(json)))
}
constructor () {
super({
name: '憨憨卡片',
priority: 50,
rule: [
// {
// reg: '#发送(.*)到',
// fnc: 'sendMsdTOTargetGroup'
// },
{
reg: '^#(发送)json(消息|信息)?([\\s\\S]*)$',
fnc: 'sendJson'
}
]
})
}

async fuck(e) {
let json = this.getFileDataToJson('/resources/json/QQjson.json')['fuck']
let msg = segment.json(JSON.stringify(json))
e.reply(msg)
}
async sendJson (e) {
let message = e.msg
message = message.replace('#发送json', '')
message = message.replace('消息', '')
message = message.replace('信息', '')
if (!message) return
logger.info(message)
let msg = [{ type: 'json', data: `${message}` }]
this.reply(msg)
return true
}

//获取Json数据
getFileDataToJson(fileName, type = 'utf-8') {
return JSON.parse(fs.readFileSync(RootPath + fileName, { encoding: type }) || null)
}
// 获取Json数据
// getFileDataToJson (fileName, type = 'utf-8') {
// return JSON.parse(fs.readFileSync(RootPath + fileName, { encoding: type }) || null)
// }

//指定群发消息
async sendMsdTOTargetGroup(e) {
let target = e.msg.replace(/#(.*)/, '').trim()
let key
if (e.msg.includes('红包')) {
key = '红包'
} else if (e.msg.includes('黑丝')) {
key = '卡片黑丝'
} else if (e.msg.includes('fuck')) {
key = 'fuck'
}
console.log(target)
if (!target) return e.reply('你没有输入要发送的群聊')
let groupList = await Bot.getGroupList()
// console.log(groupList)
console.log(groupList.get(target))
try {
if (!groupList.has(target)) {
let group = await Bot.pickGroup(target)
let msg = segment.json(JSON.stringify(this.getFileDataToJson('/resources/json/QQjson.json')[`${key}`]))
console.log(msg)
await group.sendMsg(msg)
e.reply('发送成功')
}
} catch (err) {
return e.reply(`failed to send msg, error: ${JSON.stringify(err)}`)
}
}
// 指定群发消息
// async sendMsdTOTargetGroup (e) {
// let target = e.msg.replace(/#发送(.*)到/, '').trim()
// let key
// if (e.msg.includes('红包')) {
// key = '红包'
// } else if (e.msg.includes('黑丝')) {
// key = '卡片黑丝'
// } else if (e.msg.includes('fuck')) {
// key = 'fuck'
// }
// console.log(target)
// if (!target) return e.reply('你没有输入要发送的群聊')
// let groupList = await Bot.getGroupList()
// // console.log(groupList)
// console.log(groupList.get(target))
// try {
// if (!groupList.has(target)) {
// let group = await Bot.pickGroup(target)
// let msg = segment.json(JSON.stringify(this.getFileDataToJson('/resources/json/QQjson.json')[`${key}`]))
// console.log(msg)
// await group.sendMsg(msg)
// e.reply('发送成功')
// }
// } catch (err) {
// return e.reply(`failed to send msg, error: ${JSON.stringify(err)}`)
// }
// }
}
19 changes: 10 additions & 9 deletions apps/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class manage extends plugin {
fnc: 'setPingToken'
},
{
reg: '^(#憨憨|#)设置(tmdb|TMDB) key=(.*)$',
reg: '^#憨憨设置(tmdb|TMDB) key$',
fnc: 'settmdbkey'
}
]
Expand All @@ -32,7 +32,7 @@ export class manage extends plugin {
return false
}
this.setContext('savePingToken')
await this.reply('请前往 https://ipinfo.io 注册账号获取token,并发送,设置好之后请重启', true)
await this.reply('请前往 https://ipinfo.io 注册账号获取token,并发送', true)
return false
}

Expand All @@ -57,21 +57,22 @@ export class manage extends plugin {
return false
}
this.setContext('saveTmdbKey')
await this.reply('未检测到key!请前往 https://developer.themoviedb.org/docs 注册账号,使用 #憨憨设置tmdb key 命令进行设置', true)
await this.reply('请前往 https://developer.themoviedb.org/docs 注册账号获取key,并发送', true)
return false
}

async saveTmdbKey (e) {
console.log('[用户命令]', e.msg)
let token = e.msg.replace(/^(#|#)(tmdb|TMDB) key=/, '').trim()
if (token.length != 211) {
if (!this.e.msg) return
let key = this.e.msg
console.log(key)
if (key.length != 211) {
await this.reply('tmdb key错误', true)
this.finish('settmdbkey')
this.finish('saveTmdbKey')
return
}
// todo
Config.tmdbkey = token
Config.tmdbkey = key
await this.reply('tmdb key设置成功', true)
this.finish('settmdbkey')
this.finish('saveTmdbKey')
}
}
4 changes: 2 additions & 2 deletions apps/morse.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class morse extends plugin {
// 莫斯加密
async morseEn (e) {
let encode = e.msg.replace(/^#?(|)/, '').trim()
if (!encode) return e.reply("输入不能为空", true)
if (!encode) return e.reply('输入不能为空', true)
// standart morse
let result = xmorse.encode(`${encode}`)
await this.reply(result, true)
Expand All @@ -41,7 +41,7 @@ export class morse extends plugin {
// 莫斯解密
async morseDe (e) {
let encode = e.msg.replace(/^#?(|)/, '').trim()
if (!encode) return e.reply("输入不能为空", true)
if (!encode) return e.reply('输入不能为空', true)
// standart morse
let result = xmorse.decode(`${encode}`)
await this.reply(result, true)
Expand Down
36 changes: 35 additions & 1 deletion apps/photo.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import plugin from '../../../lib/plugins/plugin.js'
import { segment } from 'icqq'
import fetch from 'node-fetch'
import axios from 'axios'
import { Config } from '../utils/config.js'
import { endingSpeech, followMe, pepTalk } from '../utils/const.js'
import { sleep } from '../utils/common.js'
import { sleep, makeForwardMsg } from '../utils/common.js'

export class photo extends plugin {
constructor () {
Expand Down Expand Up @@ -82,6 +83,12 @@ export class photo extends plugin {
reg: '^#?一二布布$',
/** 执行方法 */
fnc: 'yebb'
},
{
/** 命令正则匹配 */
reg: '^#?情侣头像$',
/** 执行方法 */
fnc: 'qltx'
}
]
})
Expand Down Expand Up @@ -129,6 +136,33 @@ export class photo extends plugin {
}
}

// 情侣头像
async qltx (e) {
let url = 'http://api.yujn.cn/api/qltx.php?type=json&lx=qltx'
let response = await fetch(url) // 调用接口获取数据
let result = await response.json()
console.log(result)
let forwardMsgs = []
forwardMsgs.push(result.title)
forwardMsgs.push(result.detail)
forwardMsgs.push('如果图片裂开了,请复制链接到浏览器打开')
if (result.image_count == 0) {
forwardMsgs.push('没有图片')
} else {
for (let i = 0; i < result.image_count; i++) {
forwardMsgs.push(result.img[i])
forwardMsgs.push(segment.image(result.img[i]))
console.log(i)
}
}

let dec = '情侣头像'
let forwardMsg = await makeForwardMsg(e, forwardMsgs, dec)
if (forwardMsg) {
await Bot.sendGroupMsg(e.group_id, forwardMsg)
}
}

// 一二布布
async yebb (e) {
// 发送消息
Expand Down
4 changes: 2 additions & 2 deletions apps/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Ping extends plugin {
rule: [
{
/** 命令正则匹配 */
reg: '^#[pP]ing ',
reg: '^#?[pP]ing ',
/** 执行方法 */
fnc: 'ping'
}
Expand All @@ -34,7 +34,7 @@ export class Ping extends plugin {
return false
}

let msg = e.msg.trim().replace(/^#[pP]ing\s/, '').replace(/https?:\/\//, '')
let msg = e.msg.trim().replace(/^#?[pP]ing\s/, '').replace(/https?:\/\//, '')
await this.reply('在ping了、在ping了。。。', true, { recallMsg: 3 })
let ipInfo; let pingRes; let domain; let ipAddress = msg; let isShowIP = false; const numberOfEchos = 6
if (e.msg.trim().includes('#Ping')) isShowIP = true
Expand Down
Loading

0 comments on commit 07769b2

Please sign in to comment.