Skip to content

Commit

Permalink
feat: 添加主人命令
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Feb 14, 2023
1 parent 15da9d8 commit e637907
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bili-bot",
"private": true,
"version": "1.2.6",
"version": "1.2.7",
"type": "module",
"scripts": {
"dev": "npm run build:icon && vite",
Expand Down Expand Up @@ -39,4 +39,4 @@
"vite": "^4.0.0",
"vue-tsc": "^1.0.11"
}
}
}
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bili-bot"
version = "1.2.6"
version = "1.2.7"
description = "哔哩哔哩-直播间管家机器人"
authors = ["半糖人类"]
license = "MIT"
Expand Down
18 changes: 17 additions & 1 deletion src/views/Robot/message/robot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ const init_listener = async () => {
message && !isEmoji && msgList.value.push({ uname, message });
isEmoji && emojiPopList.value.push(emoji);
if (!active.value) return;
// 自动下线其他机器人
if (uid === 3493116453587470) {
active.value = false;
return
}
if (message && uid !== parseInt(await getStore(LOGIN_INFO.uid))) {
if (message.includes(`@${manage.robotName}`)) {
const question = message.replace(`@${manage.robotName}`, "").trim();
Expand All @@ -189,14 +194,25 @@ const init_listener = async () => {
messages.push(...autoSlice(`@${manage.hostName} 当前粉丝数${curFans},今日已增长${curFans - todayFans},冲~`));
return;
}
// 主人命令
if (uid === 405579368) {
switch (question) {
case '下线':
active.value = false;
break;
case '上线':
active.value = true;
break;
}
return
}
if (manage.gptToken === '') return
const result = await chatGTPApi(question);
if (!result) return;
messages.push(...autoSlice(`@${formatUname(uname)}:${result}`));
}
message.includes("晚安") && messages.push(`晚安${formatUname(uname)}, 谢谢你的陪伴~`);
message.includes("晚上好") && messages.push(`${formatUname(uname)}, 晚上好啊~`);
(message.includes("新年好") || message.includes("新年快乐")) && messages.push(`@${formatUname(uname)}, 新年快乐,红包拿来~`);
if (message === "签到" || message === "打卡") {
const res = await sign_sql({ uid, uname, roomid: manage.roomid });
messages.push(...autoSlice(res));
Expand Down

0 comments on commit e637907

Please sign in to comment.