加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
透群友单人CD.js 31.19 KB
一键复制 编辑 原始数据 按行查看 历史
玉玉了 提交于 2023-05-28 12:39 . V3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940
import plugin from '../../lib/plugins/plugin.js'
import fs from 'fs'
import schedule from 'node-schedule'
import path from "path";
import lodash from 'lodash'
import common from "../../lib/common/common.js";
let ks = 0
let kb = 0
let uid = 0
let dsq2 = ""
let b = ""
let cainum = ""
let cdtime = 120; //透cd时间,单位秒
let dacdtime = 300; //打胶cd时间,单位秒
let pkcdtime = 300; //对决cd时间,单位秒
let cooldowns = new Map();
let dadowns = new Map();
let pkdowns = new Map();
let fukpath = 'resources/fuck';
if (!fs.existsSync(fukpath)) {
fs.mkdirSync(fukpath);
}
let jjpath = 'resources/fuck/jj';
if (!fs.existsSync(jjpath)) {
fs.mkdirSync(jjpath);
}
let toupath = 'resources/fuck/tou';
if (!fs.existsSync(toupath)) {
fs.mkdirSync(toupath);
}
export class fuck extends plugin {
constructor () {
super({
name: '日群友',
dsc: '随机给一位群友注射脱氧核糖核酸',
event: 'message',
priority: 5000,
rule: [
{
reg: '^#?(透|草|日)群友$',
fnc: 'fuck'
},
{
reg: '^#?(透|草|日)群主$',
fnc: 'fuckowner'
},
{
reg: '^#?(透|草|日)管理$',
fnc: 'fuckadmin'
},
{
reg: '^#?(pk|PK|对决)$',
fnc: 'jjpk'
},
{
reg: '^#?摇骰子$|我来摇$',
fnc: 'jjcai'
},
{
reg: '^#?(打胶|锻炼|嗦牛子|嗦牛牛)$',
fnc: 'dajiao'
},
{
reg: '^#?(被透查询|注射量查询)$',
fnc: 'toucha'
},
{
reg: '^#?(牛牛|牛子)(长度|查询)$',
fnc: 'jjcha'
},
{
reg: '^#?被透(榜|排行|排行榜|排名)$',
fnc: 'toubang'
},
{
reg: '^#?(牛子|牛牛)(榜|排行|排行榜|排名)$',
fnc: 'jjbang'
},
{
reg: '^#剁掉$',
fnc: 'duodiao'
},
{
reg: '^#开启银趴$|#关闭银趴$',
fnc: 'fuckset'
},
{
reg: '^#?银趴帮助$',
fnc: 'jjhelp'
},
]
})
}
async jjhelp(e) {
let mhelp = [
`银趴群小游戏使用说明:\n`,
`主人指令:#开启银趴 #关闭银趴\n`,
`通用指令:\n`,
`透群友(可以@xx) 透群主 透管理\n`,
`打胶|锻炼|嗦牛子(可以@xx) PK|对决(@xx) 摇骰子\n`,
`被透查询|牛子查询(可以@xx) 被透排行 牛子排行\n`,
`#剁掉`
]
e.reply(mhelp)
return true;
}
async fuckset(e) {
if (!e.isGroup || !e.isMaster) {
e.reply('你不是主人没有权限哦~')
return;
}
let groupId = e.group_id; // 获取群聊号
let qxpat = `resources/fuck/${groupId}.txt`;
if (e.msg.includes("#开启银趴")) {
fs.writeFileSync(qxpat,`1`)
e.reply(`${groupId}已开启银趴`)
}
if (e.msg.includes("#关闭银趴")) {
fs.writeFileSync(qxpat,`0`)
e.reply(`${groupId}已关闭银趴`)
}
}
async fuck (e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
if (!e.isMaster ) {
const userId = e.user_id;
const cooldown = cooldowns[userId];
if (cooldown && cooldown > Date.now()) {
const remainingTime = Math.ceil((cooldown - Date.now()) / 1000);
e.reply(`你已经榨不出来任何东西了, 请先休息 ${remainingTime} 秒~`);
return;
}
cooldowns[userId] = Date.now() + cdtime * 1000;
}
console.log("用户命令:", e.msg);
if(e.message[1]){
if (e.message[1].type == 'at') {
let user_id2 = e.at;
let name = e.message[1].text.replace("@","")
if (user_id2 == e.user_id) {
e.reply(`哎呀!你要艹你自己?办不到,怎么想都办不到吧!`);
return;
}
let ab = [`现在咱将把 ${name} 送给 ${e.nickname} 色色!`];
e.reply(ab);
await sleep(5000);
let num = Math.round(Math.random() * 100);
if (num <= 10) {
let msg = [`哎呀~${e.nickname} 让亲狗的爱群友 ${name} 跑掉了呢~下次再试试吧~`]
e.reply(msg);
} else if (num <= 20) {
let msg = [`哎呀!${e.nickname} 逮到了亲狗的爱群友 ${name} 结果给艹歪了,只因不行,好可惜呢~`]
e.reply(msg);
} else if (num > 20) {
let ztime = (Math.random() * 60).toFixed(2);
let znum = (Math.random() * 50).toFixed(2);
let zrgp = `resources/fuck/tou/${e.group_id}`;
if (!fs.existsSync(zrgp)) {
fs.mkdirSync(zrgp);
}
let zr = `resources/fuck/tou/${e.group_id}/${user_id2}.txt`;
if (!fs.existsSync(zr)) {
fs.writeFileSync(zr,`0`);
console.log(`${user_id2}数据文件不存在自动创建`)
}
let lszr = +fs.readFileSync(zr);
let dqzr = (lszr + +znum).toFixed(2);
await fs.writeFileSync(zr, dqzr);
let msg = [`好欸!${e.nickname} 用时 ${ztime}秒,成功给亲狗的爱群友 ${name} 注射了 ${znum}毫升 的脱氧核糖核酸~今日被注射总量:${dqzr}毫升`, segment.image(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${user_id2}`)]
e.reply(msg);
}
}
}else {
let ab = [`现在咱将随机抽取一位幸运裙友送给 ${e.nickname} 色色!`];
e.reply(ab);
await sleep(5000);
let map = await e.group.getMemberMap();
let arrMember = Array.from(map.values());
let mem = arrMember[Math.round(Math.random() * (arrMember.length-1))];
let num = Math.round(Math.random() * 100);
if (mem.user_id == e.user_id) {
e.reply(`哎呀!你要艹你自己?办不到,怎么想都办不到吧!`);
return;
}
if (num <= 10) {
let msg = [`哎呀~${e.nickname} 让亲狗的爱群友 ${mem.nickname} 跑掉了呢~下次再试试吧~`]
e.reply(msg);
} else if (num <= 20) {
let msg = [`哎呀!${e.nickname} 成功逮到了亲狗的爱群友 ${mem.nickname} 结果给艹歪了,只因不行,好可惜呢~`]
e.reply(msg);
} else if (num > 20) {
let ztime = (Math.random() * 60).toFixed(2);
let znum = (Math.random() * 50).toFixed(2);
let zrgp = `resources/fuck/tou/${e.group_id}`;
if (!fs.existsSync(zrgp)) {
fs.mkdirSync(zrgp);
}
let zr = `resources/fuck/tou/${e.group_id}/${mem.user_id}.txt`;
if (!fs.existsSync(zr)) {
fs.writeFileSync(zr,`0`);
console.log(`${mem.user_id}数据文件不存在自动创建`)
}
let lszr = +fs.readFileSync(zr);
let dqzr = (lszr + +znum).toFixed(2);
await fs.writeFileSync(zr, dqzr);
let msg = [`好欸!`,segment.at(e.user_id),` 用时 ${ztime}秒,成功给亲狗的爱群友 ${mem.nickname} 注射了 ${znum}毫升 的脱氧核糖核酸~今日被注射总量:${dqzr}毫升`, segment.image(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${mem.user_id}`)]
e.reply(msg);
}
}
}
async fuckowner (e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
if (!e.isMaster ) {
const userId = e.user_id;
const cooldown = cooldowns[userId];
if (cooldown && cooldown > Date.now()) {
const remainingTime = Math.ceil((cooldown - Date.now()) / 1000);
e.reply(`你已经榨不出来任何东西了, 请先休息 ${remainingTime} 秒~`);
return;
}
cooldowns[userId] = Date.now() + cdtime * 1000;
}
console.log("用户命令:", e.msg);
let map = await e.group.getMemberMap();
let arrMember = Array.from(map.values());
if (e.group.pickMember(e.user_id).is_owner) {
let msg = [segment.at(e.user_id),"尊狗的贵群主,你要艹你自己?" ]
e.reply(msg)
} else {
let mem = arrMember[Math.round(Math.random() * (arrMember.length-1))];
while (true) {
if (e.group.pickMember(mem.user_id).is_owner) {
let ab = [`现在咱将把群主 ${mem.nickname} 送给 ${e.nickname} 色色!`];
e.reply(ab);
await sleep(5000);
let num = Math.round(Math.random() * 100);
if (num <= 10) {
let msg = [`哎呀~${e.nickname} 让尊狗的贵群主 ${mem.nickname} 跑掉了呢~下次再试试吧~`]
e.reply(msg);
} else if (num <= 20) {
let msg = [`哎呀!${e.nickname} 成功逮到了尊狗的贵群主 ${mem.nickname} 结果给艹歪了,只因不行,好可惜呢~`]
e.reply(msg);
} else if (num > 20) {
let ztime = (Math.random() * 60).toFixed(2);
let znum = (Math.random() * 50).toFixed(2);
let zrgp = `resources/fuck/tou/${e.group_id}`;
if (!fs.existsSync(zrgp)) {
fs.mkdirSync(zrgp);
}
let zr = `resources/fuck/tou/${e.group_id}/${mem.user_id}.txt`;
if (!fs.existsSync(zr)) {
fs.writeFileSync(zr,`0`);
console.log(`${mem.user_id}数据文件不存在自动创建`)
}
let lszr = +fs.readFileSync(zr);
let dqzr = (lszr + +znum).toFixed(2);
await fs.writeFileSync(zr, dqzr);
let msg = [`好欸!${e.nickname} 用时 ${ztime}秒,成功给尊狗的贵群主 ${mem.nickname} 注射了 ${znum}毫升 的脱氧核糖核酸~今日被注射总量:${dqzr}毫升`, segment.image(`http://q1.qlogo.cn/g?b=qq&nk=${mem.user_id}&s=640`)]
e.reply(msg);
}
break
} else {
mem = arrMember[Math.round(Math.random() * (arrMember.length-1))];
}
}
}
}
async fuckadmin (e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
if (!e.isMaster ) {
const userId = e.user_id;
const cooldown = cooldowns[userId];
if (cooldown && cooldown > Date.now()) {
const remainingTime = Math.ceil((cooldown - Date.now()) / 1000);
e.reply(`你已经榨不出来任何东西了, 请先休息 ${remainingTime} 秒~`);
return;
}
cooldowns[userId] = Date.now() + cdtime * 1000;
}
console.log("用户命令:", e.msg);
let map = await e.group.getMemberMap();
let arrMember = Array.from(map.values());
let mem = arrMember[Math.round(Math.random() * (arrMember.length-1))];
while (true) {
if (e.group.pickMember(mem.user_id).is_admin) {
if (e.group.pickMember(mem.user_id).is_admin && mem.user_id == e.user_id) {
let msg = [ segment.at(e.user_id),"亲狗的爱管理,你要艹你自己?"]
e.reply(msg);
return;
}
let ab = [`现在咱将把管理 ${mem.nickname} 送给 ${e.nickname} 色色!`];
e.reply(ab);
await sleep(5000);
let num = Math.round(Math.random() * 100);
if (num <= 10) {
let msg = [`哎呀~${e.nickname} 让亲狗的爱管理 ${mem.nickname} 跑掉了呢~下次再试试吧~`]
e.reply(msg);
} else if (num <= 20) {
let msg = [`哎呀!${e.nickname} 成功逮到了亲狗的爱管理 ${mem.nickname} 结果给艹歪了,只因不行,好可惜呢~`]
e.reply(msg);
} else if (num > 20) {
let ztime = (Math.random() * 60).toFixed(2);
let znum = (Math.random() * 50).toFixed(2);
let zrgp = `resources/fuck/tou/${e.group_id}`;
if (!fs.existsSync(zrgp)) {
fs.mkdirSync(zrgp);
}
let zr = `resources/fuck/tou/${e.group_id}/${mem.user_id}.txt`;
if (!fs.existsSync(zr)) {
fs.writeFileSync(zr,`0`);
console.log(`${mem.user_id}数据文件不存在自动创建`)
}
let lszr = +fs.readFileSync(zr);
let dqzr = (lszr + +znum).toFixed(2);
await fs.writeFileSync(zr, dqzr);
let msg = [`好欸!${e.nickname} 用时 ${ztime}秒,成功给亲狗的爱管理 ${mem.nickname} 注射了 ${znum}毫升 的脱氧核糖核酸~今日被注射总量:${dqzr}毫升`, segment.image(`https://q1.qlogo.cn/g?b=qq&s=0&nk=${mem.user_id}`)]
e.reply(msg);
}
break
} else {
mem = arrMember[Math.round(Math.random() * (arrMember.length-1))];
}
}
}
async dajiao (e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
if (!e.isMaster ) {
const userId = e.user_id;
const dadown = dadowns[userId];
if (dadown && dadown > Date.now()) {
const remainingTime = Math.ceil((dadown - Date.now()) / 1000);
e.reply(`运动太频繁了捏, 请先休息 ${remainingTime} 秒~`);
return;
}
dadowns[userId] = Date.now() + dacdtime * 1000;
}
console.log("用户命令:", e.msg);
if(e.message[1]){
if (e.message[1].type == 'at') {
kb = 1
let user_id2 = e.at;
let name = e.message[1].text.replace("@","")
let djgp = `resources/fuck/jj/${e.group_id}`;
if (!fs.existsSync(djgp)) {
fs.mkdirSync(djgp);
}
let djjj = `resources/fuck/jj/${e.group_id}/${user_id2}.txt`;
if (!fs.existsSync(djjj)) {
fs.writeFileSync(djjj,`10`);
let msg1 = [`${name} 牛子不存在自动创建了喵~当前长度为 10 厘米~`];
e.reply(msg1);
await sleep(2000);
}
await sleep(3000);
let djnum = (Math.random() * 2).toFixed(2);
let djtime = (Math.random() * 60).toFixed(2);
let key = Math.random() * 10;
console.log(key);
if (key <= 5) {
let lsdj = +fs.readFileSync(djjj);
let dqdj = (lsdj + +djnum).toFixed(2);
await fs.writeFileSync(djjj,dqdj );
let msg3 = [`恭喜 ${e.nickname} 成功给 ${name} 的牛子做完了运动,使其增加了 ${djnum} 厘米,当前长度为 ${dqdj} 厘米喵~`]
e.reply(msg3);
}
} else if (key > 5) {
let lsdj = +fs.readFileSync(djjj);
let dqdj = (lsdj - +djnum).toFixed(2);
await fs.writeFileSync(djjj,dqdj );
let msg3 = [`好可惜呢,${e.nickname}${name} 的牛子做运动失败了喵,牛子受到刺激缩短了 ${djnum} 厘米,当前长度为 ${dqdj} 厘米喵~`]
e.reply(msg3);
}
}else{
let djgp = `resources/fuck/jj/${e.group_id}`;
if (!fs.existsSync(djgp)) {
fs.mkdirSync(djgp);
}
let djjj = `resources/fuck/jj/${e.group_id}/${e.user_id}.txt`;
if (!fs.existsSync(djjj)) {
fs.writeFileSync(djjj,`10`);
let msg1 = [`${e.nickname} 牛子不存在自动创建了喵~当前长度为 10 厘米~`];
e.reply(msg1);
await sleep(2000);
}
await sleep(3000);
let djnum = (Math.random() * 2).toFixed(2);
let djtime = (Math.random() * 60).toFixed(2);
let key = Math.random() * 10;
console.log(key);
if (key <= 7) {
let lsdj = +fs.readFileSync(djjj);
let dqdj = (lsdj + +djnum).toFixed(2);
await fs.writeFileSync(djjj,dqdj );
let msg3 = [`恭喜 ${e.nickname} 成功给牛子做完了运动,使其增加了 ${djnum} 厘米,当前长度为 ${dqdj} 厘米喵~`]
e.reply(msg3);
} else if (key > 7) {
let lsdj = +fs.readFileSync(djjj);
let dqdj = (lsdj - +djnum).toFixed(2);
await fs.writeFileSync(djjj,dqdj );
let msg3 = [`好可惜呢,${e.nickname} 给牛子做运动失败了喵,牛子受到刺激缩短了 ${djnum} 厘米,当前长度为 ${dqdj} 厘米喵~`]
e.reply(msg3);
}
}
}
async jjpk(e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
if (!e.isMaster ) {
const userId = e.user_id;
const pkdown = pkdowns[userId];
if (pkdown && pkdown > Date.now()) {
const remainingTime = Math.ceil((pkdown - Date.now()) / 1000);
let fmsg = [
segment.at(e.user_id),
`你的牛子还没有恢复士气捏, 请先休息 ${remainingTime} 秒~`
];
e.reply(fmsg)
return;
}
pkdowns[userId] = Date.now() + pkcdtime * 1000;
}
console.log("用户命令:", e.msg);
if(e.message[1]){
if (e.message[1].type == 'at') {
let user_id2 = e.at;
if (e.user_id == e.at) {
e.reply(`你一个人怎么进行pk嘛!哎哟~`)
return;
}
let name = e.message[1].text.replace("@","")
let djgp = `resources/fuck/jj/${e.group_id}`;
if (!fs.existsSync(djgp)) {
fs.mkdirSync(djgp);
}
let djjj = `resources/fuck/jj/${e.group_id}/${user_id2}.txt`;
let adjjj = `resources/fuck/jj/${e.group_id}/${e.user_id}.txt`;
if (!fs.existsSync(djjj)) {
fs.writeFileSync(djjj,`10`);
let msg1 = [`${name} 牛子不存在自动创建了喵~当前长度为 10 厘米~`];
e.reply(msg1);
await sleep(2000);
}
if (!fs.existsSync(adjjj)) {
fs.writeFileSync(adjjj,`10`);
let msg5 = [`${e.nickname} 牛子不存在自动创建了喵~当前长度为 10 厘米~`];
e.reply(msg5);
await sleep(2000);
}
if (adjjj < 0) {
let msgg = [
segment.at(e.user_id),
`你的牛子长度不够,无法进行pk!`
]
e.reply(msgg)
return;
}
if (djjj < 0) {
let msgj = [
segment.at(e.user_id),
`你的对手牛子长度不够,无法进行pk!`
]
e.reply(msgj)
return;
}
let msg2 = [`${e.nickname}${name} 发起了pk,让咱等等喵~`];
let img = [segment.image(`https://api.andeer.top/API/gif_beat_j.php?bqq=${e.user_id}&cqq=${user_id2}`)]
e.reply(msg2);
await e.reply(img)
await sleep(5000);
let djnum = (Math.random() * 2).toFixed(2);
let djtime = (Math.random() * 60).toFixed(2);
let key = Math.random() * 10;
console.log(key);
if (key < 5) {
let lsdj = +fs.readFileSync(djjj);
let alsdj = +fs.readFileSync(adjjj);
let dqdj = (lsdj + +djnum).toFixed(2);
let adqdj = (alsdj - +djnum).toFixed(2);
await fs.writeFileSync(djjj,dqdj );
await fs.writeFileSync(adjjj,adqdj );
let msg3 = [`恭喜 ${name} 在本次pk中大获全胜喵~本次掉落物品牛子${djnum}cm。\n战利品结算:\n${e.nickname}${alsdj}cm⤵${adqdj}cm\n${name}${lsdj}cm⤴${dqdj}cm `]
e.reply(msg3);
} else if (key == 5) {
let msg3 = [`${e.nickname}${name} 本次打成了平手喵~`]
e.reply(msg3);
}else if (key > 5) {
let lsdj = +fs.readFileSync(djjj);
let alsdj = +fs.readFileSync(adjjj);
let dqdj = (lsdj - +djnum).toFixed(2);
let adqdj = (alsdj + +djnum).toFixed(2);
await fs.writeFileSync(djjj,dqdj );
await fs.writeFileSync(adjjj,adqdj );
let msg3 = [`恭喜 ${e.nickname} 在本次pk中大获全胜喵~本次掉落物品牛子${djnum}cm。\n战利品结算:\n${e.nickname}${alsdj}cm⤴${adqdj}cm\n${name}${lsdj}cm⤵${dqdj}cm `]
e.reply(msg3);
}
}
}
}
async jjcai(e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
if (!e.isMaster && ks == 0 ) {
const userId = e.user_id;
const cooldown = cooldowns[userId];
if (cooldown && cooldown > Date.now()) {
const remainingTime = Math.ceil((cooldown - Date.now()) / 1000);
e.reply(`你已经榨不出来任何东西了, 请先休息 ${remainingTime} 秒~`);
return;
}
cooldowns[userId] = Date.now() + pkcdtime * 1000;
}
console.log("用户命令:", e.msg);
let djgp = `resources/fuck/jj/${e.group_id}`;
if (!fs.existsSync(djgp)) {
fs.mkdirSync(djgp);
}
let djjj = `resources/fuck/jj/${e.group_id}/${e.user_id}.txt`;
if (!fs.existsSync(djjj)) {
fs.writeFileSync(djjj, `10`);
let msg1 = [`${e.nickname} 牛子不存在自动创建了喵~当前长度为 10 厘米~`];
e.reply(msg1);
await sleep(2000);
}
if (e.msg == "摇骰子" && ks == 1) {
e.reply('我正在和别人玩呢,没空,你先等会。')
return
}
if (e.msg == "摇骰子" || e.msg == "#摇骰子" && ks == 0) {
b = Math.floor(Math.random() * 6) + 1;
cainum = (Math.random() * 2).toFixed(2);
let abc = [
segment.at(e.user_id),
`我摇出了${b},这次赌注是牛子${cainum}厘米。给你30秒,发送“我来摇”摇出你的点数吧`
]
e.reply(abc)
ks = 1
uid = e.user_id
dsq2 = setTimeout(function () {
if (ks == 1) {
let lsdj = +fs.readFileSync(djjj);
let dqdj = (lsdj - +cainum).toFixed(2);
fs.writeFileSync(djjj, dqdj);
e.reply(`30秒还不摇,给我寄\n惩罚结算:\n${e.nickname}${lsdj}cm⤵${dqdj}cm`)
ks = 0
}
}, 20000);
}
if (e.msg == "我来摇" || e.msg == "#我来摇" && ks == 1 && uid == e.user_id) {
let a = Math.floor(Math.random() * 6) + 1;
if (a > b) {
let lsdj = +fs.readFileSync(djjj);
let dqdj = (lsdj + +cainum).toFixed(2);
await sleep(1000);
let msga = [
`可恶啊,你摇出了${a},你的数字比我大,这次你赢了!\n`,
`战利品结算:\n${e.nickname}${lsdj}cm⤴${dqdj}cm`
];
fs.writeFileSync(djjj, dqdj);
await e.reply(msga);
ks = 0
}
else if (a < b) {
let lsdj = +fs.readFileSync(djjj);
let dqdj = (lsdj - +cainum).toFixed(2);
await sleep(1000);
let msgb = [
`哈哈,你摇出了${a},我的数字比你的大,这次我赢了!\n`,
`惩罚结算:\n${e.nickname}${lsdj}cm⤵${dqdj}cm`
];
fs.writeFileSync(djjj, dqdj);
await e.reply(msgb);
ks = 0
}
}
}
async toucha(e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
console.log("用户命令:", e.msg);
if(e.message[1]){
if (e.message[1].type == 'at') {
let uid = e.at;
let name = e.message[1].text.replace("@","")
let zr = `resources/fuck/tou/${e.group_id}/${uid}.txt`;
if (!fs.existsSync(zr)) {
let msg1 = [`${name} 今天还没有被透过!`]
e.reply(msg1)
return;
}
let lsdj = +fs.readFileSync(zr);
let msg2 = [`${name} 今天总共被注射了 ${lsdj} 毫升的脱氧核糖核酸喵~`]
e.reply(msg2);
}
} else {
let uid = e.user_id;
let zr = `resources/fuck/tou/${e.group_id}/${e.nickname}#${uid}.txt`;
if (!fs.existsSync(zr) ) {
let msg1 = [segment.at(uid),` 你今天还没有被透过!`]
e.reply(msg1)
return;
}
let lsdj = +fs.readFileSync(zr);
let msg2 = [segment.at(uid),` 你今天总共被注射了 ${lsdj} 毫升的脱氧核糖核酸喵~`]
e.reply(msg2);
}
}
async jjcha(e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
console.log("用户命令:", e.msg);
if(e.message[1]){
if (e.message[1].type == 'at') {
let uid = e.at;
let name = e.message[1].text.replace("@","")
let zr = `resources/fuck/jj/${e.group_id}/${uid}.txt`;
if (!fs.existsSync(zr)) {
let msg1 = [`${name} 还没有牛子!`]
e.reply(msg1)
return;
}
let lsjj = +fs.readFileSync(zr);
let msg2 = [`${name} 的牛子当前长度为 ${lsjj} 厘米喵~`]
e.reply(msg2);
}
} else {
let uid = e.user_id;
let zr = `resources/fuck/jj/${e.group_id}/${uid}.txt`;
if (!fs.existsSync(zr)) {
let msg1 = [segment.at(uid),` 你还没有牛子!`]
e.reply(msg1)
return;
}
let lsjj = +fs.readFileSync(zr);
let msg2 = [segment.at(uid),` 你的牛子当前长度为 ${lsjj} 厘米喵~`]
e.reply(msg2);
}
}
async toubang(e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
const dirname = `resources/fuck/tou/${e.group_id}/`; // 修改为您的目录
if (!fs.existsSync(dirname)) {
await e.reply('本群还没有被透记录!');
return;
}
const files = fs.readdirSync(dirname);
const txtFiles = files.filter(file => path.extname(file) === '.txt');
let obj = [];
let bbj = []
for (const file of txtFiles) {
const qq = path.basename(file, '.txt');
const content = Number(fs.readFileSync(`${dirname}/${file}`, 'utf-8').trim());
obj.push(qq);
bbj.push(content)
}
// 将头像和内容合并
let res = obj.map((qq, i) => ({
qq,
content: bbj[i]
}));
// 根据内容排序
res.sort((a, b) => b.content - a.content);
console.log(res);
let msgRes = []
for (let i = 0; i < Math.min(res.length, 20); i++) {
const { qq, content } = res[i];
msgRes[i] = [
segment.image(`http://q1.qlogo.cn/g?b=qq&nk=${qq}&s=100`),
`第${i+1}名:${content} mL`
];
}
e.reply(`本群今日被透排行榜如下:`)
await sleep(1000);
await e.reply(await common.makeForwardMsg(e, msgRes));
}
async jjbang(e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
const dirname = `resources/fuck/jj/${e.group_id}/`; // 修改为您的目录
if (!fs.existsSync(dirname)) {
await e.reply('本群还没有牛子记录!');
return;
}
const files = fs.readdirSync(dirname);
const txtFiles = files.filter(file => path.extname(file) === '.txt');
let obj = [];
let bbj = []
for (const file of txtFiles) {
const qq = path.basename(file, '.txt');
const content = Number(fs.readFileSync(`${dirname}/${file}`, 'utf-8').trim());
obj.push(qq);
bbj.push(content)
}
// 将头像和内容合并
let res = obj.map((qq, i) => ({
qq,
content: bbj[i]
}));
// 根据内容排序
res.sort((a, b) => b.content - a.content);
console.log(res);
let msgRes = []
for (let i = 0; i < Math.min(res.length, 20); i++) {
const { qq, content } = res[i];
msgRes[i] = [
segment.image(`http://q1.qlogo.cn/g?b=qq&nk=${qq}&s=100`),
`第${i+1}名:${content} cm`
];
}
e.reply(`本群牛子排行榜如下:`)
await sleep(1000);
await e.reply(await common.makeForwardMsg(e, msgRes));
}
async duodiao(e) {
if (!e.isGroup) {
e.reply("只能在群聊使用呢~");
return;
}
let groupId = e.group_id; // 获取群聊号
let dem = `resources/fuck/${groupId}.txt`
if (!fs.existsSync(dem)) {
fs.writeFileSync(dem,`0`);
console.log(`${groupId}权限文件不存在自动创建 0`)
}
let qx = fs.readFileSync(dem)
console.log(`${groupId}权限为${qx}`)
if (qx == 0 && !e.isMaster ) {
e.reply(`${groupId}还未开启银趴!`);
return;
}
console.log("用户命令:", e.msg);
let uid = e.user_id
let zr = `resources/fuck/jj/${e.group_id}/${uid}.txt`;
if (!fs.existsSync(zr)) {
let msg1 = [`${name} 还没有牛子!`]
e.reply(msg1)
return;
}
fs.unlinkSync(zr)
let msg2 = [
segment.at(uid),
segment.image('https://gchat.qpic.cn/gchatpic_new/746659424/4144974507-2439053290-125E4E51B9D45F2C955E6675AF7C6CEE/0?term=3&is_origin=0')
];
await e.reply(msg2);
}
}
// 延迟执行函数
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const rule = '55 59 23 * * *';
const job = schedule.scheduleJob(rule, () => {
const folderPath = 'resources/fuck/tou';
fs.readdir(folderPath, (err, files) => {
if (err) throw err;
files.forEach((file) => {
const filePath = path.join(folderPath, file);
if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory() && /^\d+$/.test(file)) {
fs.rmdirSync(filePath, { recursive: true });
console.log(`今日注射量已清空`);
}
});
});
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化