Skip to content

Commit

Permalink
optimize catch uid
Browse files Browse the repository at this point in the history
  • Loading branch information
snowtafir committed Aug 25, 2024
1 parent 024ff6b commit f82e100
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/bilibili.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default class YukiBili extends Plugin {
this.e.reply("未取得bot主人身份,无权限添加B站动态订阅");
} else {
// 从消息中提取UID
const uid = this.e.msg.replace(/^(#|\/)(yuki|)?(||add|ADD)(b|B|bili|bilibili||)\s*(\s*|\s*|\s*|\s*|\s*)*/g, "").trim();
const uid = this.e.msg.replace(/^(#|\/)(yuki|)?(||add|ADD)(b|B|bili|bilibili||)\s*(\s*|\s*|\s*|\s*|\s*)*/g, "").trim().replace(/^(uid|UID)?(:|)?/g, '');
if (!uid) {
this.e.reply(`请在指令末尾指定订阅的B站up主的UID!`);
return true;
Expand Down Expand Up @@ -190,7 +190,7 @@ export default class YukiBili extends Plugin {
this.e.reply("未取得bot主人身份,无权限删除B站动态订阅");
} else {
// 提取用户输入的UID
const uid = this.e.msg.replace(/^(#|\/)(yuki|)?(||del|DEL)(b|B|bili|bilibili||)\s*(\s*|\s*|\s*|\s*|\s*)*/g, "").trim();
const uid = this.e.msg.replace(/^(#|\/)(yuki|)?(||del|DEL)(b|B|bili|bilibili||)\s*(\s*|\s*|\s*|\s*|\s*)*/g, "").trim().replace(/^(uid|UID)?(:|)?/g, '');
if (!uid) {
this.e.reply(`请在指令末尾指定订阅的B站up主的UID!`);
return;
Expand Down Expand Up @@ -444,7 +444,7 @@ export default class YukiBili extends Plugin {

// 处理群组订阅
if (subData.group && Object.keys(subData.group).length > 0) {
messages.push("------群组B站订阅------");
messages.push("------群组B站订阅------\n");
Object.keys(subData.group).forEach((groupId) => {
messages.push(`群组ID:${groupId}:`);
subData.group[groupId].forEach((item: { type: any[]; uid: any; name: any; }) => {
Expand All @@ -467,7 +467,7 @@ export default class YukiBili extends Plugin {

// 处理私聊订阅
if (subData.private && Object.keys(subData.private).length > 0) {
messages.push("------私聊B站订阅------");
messages.push("\n------私聊B站订阅------");
Object.keys(subData.private).forEach((userId) => {
messages.push(`用户ID:${userId}:`);
subData.private[userId].forEach((item: { type: any[]; uid: any; name: any; }) => {
Expand Down

0 comments on commit f82e100

Please sign in to comment.