Skip to content

Commit

Permalink
Merge pull request #422 from Giftia/dev
Browse files Browse the repository at this point in the history
v3.7.2
  • Loading branch information
Giftia authored Mar 6, 2023
2 parents 22ca577 + 70d0d0a commit ba5872c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 43 deletions.
8 changes: 0 additions & 8 deletions .sequelizerc

This file was deleted.

4 changes: 2 additions & 2 deletions database.json → config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
},
"development": {
"dialect": "sqlite",
"storage": "./dev.db"
"storage": "./config/dev.db"
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chatdacs",
"version": "3.7.1",
"version": "3.7.2",
"decription": "Chatbot : shaDiao Ai Chat System",
"license": "GPL-3.0",
"scripts": {
Expand Down Expand Up @@ -68,4 +68,4 @@
"engines": {
"node": "~14"
}
}
}
13 changes: 6 additions & 7 deletions plugins/grassPictureGenerate.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
module.exports = {
插件名: "黑白生草图生成器插件",
指令: "^[/!]?黑白图 (.*)",
版本: "2.1",
版本: "2.2",
作者: "Giftina",
描述: "生成一张黑白生草图。",
使用示例: "黑白图 当你凝望神圣手雷的时候,神圣手雷也在凝望你 あなたが神圣手雷を見つめるとき、神圣手雷もあなたを見つめています[图片]",
使用示例: "黑白图 语段1 语段2[图片]",
预期返回: "[一张黑白生草图]",

execute: async function (msg, userId, userName, groupId, groupName, options) {
// 获取第一行字符串
const mainContent = msg.split("[")[0].replace(/^[/!]? /g, "") ?? "当你凝望神圣手雷的时候,神圣手雷也在凝望你";
const pictureSources = Constants.img_url_reg.exec(msg)[0] ?? "https://gchat.qpic.cn/gchatpic_new/1005056803/2063243247-2847024251-657109635D3492BDB455DEFA8936AD96/0?term=3"; // 取图片链接
const mainContent = msg.split("[")[0].replace(/^[/!]? /g, "") ?? "智械危机 オムニッククライシス";
const pictureSources = Constants.img_url_reg.exec(msg)[0] ?? "https://gchat.qpic.cn/gchatpic_new/1005056803/2147311946-3104545614-E3DCA7F57C09808B2AFAAB22172197B8/0"; // 取图片链接

const firstContent = mainContent?.split(" ")[0]?.trim() ?? "当你凝望神圣手雷的时候,神圣手雷也在凝望你"; // 第一行内容
const secondContent = mainContent?.split(" ")[1]?.trim() ?? ""; // 第二行内容, 替代"あなたが神圣手雷を見つめるとき、神圣手雷もあなたを見つめています";
const firstContent = mainContent?.split(" ")[0]?.trim() ?? "智械危机"; // 第一行内容
const secondContent = mainContent?.split(" ")[1]?.trim() ?? "オムニッククライシス"; // 第二行内容

const fileURL = await generatePicture(pictureSources, firstContent, secondContent);
return { type: "picture", content: { file: fileURL } };
Expand Down
46 changes: 22 additions & 24 deletions plugins/lifeRestart.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
插件名: "人生重开模拟器插件",
指令: "^[/!]?人生重开$|^[/!]?选择天赋 (.*)|^[/!]?分配属性 (.*)|^[/!]?人生总结$",
版本: "1.0",
版本: "1.1",
作者: "Giftina",
描述: "一个人生重开模拟器,区别于原作,该版本非常真实。原作 https://github.com/VickScarlet/lifeRestart",
使用示例: "人生重开",
Expand Down Expand Up @@ -204,29 +204,27 @@ async function LifeSummary(userId, userName) {
* @returns
*/
async function Talents10x(data) {
return new Promise((resolve, _reject) => {
const talents = JSON.parse(data);
const talentsLength = Object.keys(talents).length;

let randomTalents = "",
talentsList = [];
for (let i = 0; i < 10; i++) {
// 随机选天赋index
const randomTalentIndex = Math.floor(Math.random() * talentsLength);
// 把index转换为天赋id,取出天赋数据
const talent = talents[Object.keys(talents)[randomTalentIndex]];
const talentName = talent.name, talentDescription = talent.description;

// 按天赋稀有度 grade 增加图标
const grade = gradeIconMaps[talent?.grade || 0];

// 把天赋名称和描述拼接成一个字符串
const talentsDescription = `\n${i} ${grade}${talentName}${talentDescription})`;
randomTalents += talentsDescription;
talentsList.push(randomTalentIndex);
}
resolve({ randomTalents: randomTalents, talentsList: talentsList });
});
const talents = JSON.parse(data);
const talentsLength = Object.keys(talents).length;

let randomTalents = "",
talentsList = [];
for (let i = 0; i < 10; i++) {
// 随机选天赋index
const randomTalentIndex = Math.floor(Math.random() * talentsLength);
// 把index转换为天赋id,取出天赋数据
const talent = talents[Object.keys(talents)[randomTalentIndex]];
const talentName = talent.name, talentDescription = talent.description;

// 按天赋稀有度 grade 增加图标
const grade = gradeIconMaps[talent?.grade || 0];

// 把天赋名称和描述拼接成一个字符串
const talentsDescription = `\n${i} ${grade}${talentName}${talentDescription})`;
randomTalents += talentsDescription;
talentsList.push(randomTalentIndex);
}
return { randomTalents: randomTalents, talentsList: talentsList };
}

const fs = require("fs");
Expand Down

0 comments on commit ba5872c

Please sign in to comment.