koishi-plugin-bomb-game
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -50,9 +50,4 @@ "use strict"; | ||
ctx.command('炸弹菜单') | ||
.action(async ({}) => { | ||
return ` | ||
══炸弹专家══ | ||
埋雷 抢雷 排雷 | ||
排雷触发 炸弹触发 | ||
领取炸弹 我的信息 | ||
雷人榜`; | ||
.action(async ({ session }) => { | ||
session.bot.sendMessage(session.channelId, koishi_1.h.image((0, url_1.pathToFileURL)((0, path_1.resolve)(__dirname, './炸弹专家MAX.jpg')).href), session.guildId); | ||
}); | ||
@@ -147,4 +142,14 @@ ctx.command('炸弹菜单') | ||
const { userId } = session; | ||
const today = new Date().toISOString().split('T')[0]; //当前时间 | ||
const today = new Date(); | ||
const checkInRecord = await ctx.database.get('Bombs', { userId }); //获取用户签到时间 | ||
const currentDate = new Date(); | ||
// 获取当前年份 | ||
const year = currentDate.getFullYear(); | ||
// 获取当前月份(注意,返回的月份是从 0 开始计数的,所以需要加上 1) | ||
const month = currentDate.getMonth() + 1; | ||
// 获取当前日期 | ||
const date = currentDate.getDate(); | ||
// 将时间部分合并为一个字符串 | ||
const formattedTime = `${year}-${month}-${date}`; | ||
console.log("当前时间:" + formattedTime); | ||
const one_phrase = await ctx.http.get('https://v1.hitokoto.cn/?c=a'); | ||
@@ -159,7 +164,7 @@ const hitokoto = one_phrase.hitokoto + '——' + one_phrase.from; | ||
if (checkInRecord.length === 0) { | ||
await ctx.database.create('Bombs', { userId, today, Bombs, Bombs_trigger: '暂无触发词', Clearance_trigger: '暂无触发词', Bomb_kill: 0 }); | ||
await ctx.database.create('Bombs', { userId, today: formattedTime, Bombs, Bombs_trigger: '暂无触发词', Clearance_trigger: '暂无触发词', Bomb_kill: 0 }); | ||
return msg.signInSuccess; | ||
} | ||
//判断用户是否领取 | ||
if (checkInRecord[0].today === today) { | ||
if (checkInRecord[0].today === formattedTime) { | ||
return msg.alreadySignedIn; | ||
@@ -169,3 +174,3 @@ } | ||
console.log(msg.signInSuccess); | ||
await ctx.database.set('Bombs', { userId }, { today, Bombs: checkInRecord[0].Bombs + Bombs }); | ||
await ctx.database.set('Bombs', { userId }, { today: formattedTime, Bombs: checkInRecord[0].Bombs + Bombs }); | ||
return msg.signInSuccess; | ||
@@ -172,0 +177,0 @@ } |
{ | ||
"name": "koishi-plugin-bomb-game", | ||
"description": "[炸弹专家],需要搭配QQ群管理或群主使用", | ||
"version": "1.6.0", | ||
"description": "【炸弹专家MAX】", | ||
"version": "1.7.0", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "typings": "lib/index.d.ts", |
@@ -5,25 +5,2 @@ # koishi-plugin-bomb-game | ||
# 炸弹专家 | ||
## ✨炸弹小游戏,需要搭配QQ群管理或群主使用✨ | ||
## 目前指令: | ||
领取炸弹 \ | ||
埋雷 \ | ||
排雷 \ | ||
抢雷 \ | ||
排雷触发 \ | ||
炸弹菜单 \ | ||
炸弹触发 \ | ||
雷人榜 | ||
### 问题 | ||
埋雷成功是不会触发回复的 \ | ||
排雷失败也是不会触发回复的 \ | ||
NTQQ/QQNT可能会出现未知错误这种情况(我忘记是叫什么了 \ | ||
这种情况请使用go—cqhttpp+onebot \ | ||
详细看文档 \ | ||
内置gocq+内置/外置qsign教程(推荐): \ | ||
https://forum.koishi.xyz/t/topic/4789 \ | ||
外置gocq+外置qsign教程(进阶): \ | ||
【外置的koishi-qsign-gocqhttp接入教程-哔哩哔哩】 \ | ||
https://b23.tv/o9lz7Wo | ||
【炸弹专家MAX】 |
842745
6
322
6