@akilles/soundcloud-watcher 2.2.2 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -4
- package/soundcloud_watcher.ts +36 -5
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akilles/soundcloud-watcher",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"description": "OpenClaw plugin to monitor SoundCloud account and track artist releases",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"openclaw": {
|
|
@@ -39,13 +39,11 @@
|
|
|
39
39
|
"README.md",
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"@types/node": "^22.0.0"
|
|
44
|
-
},
|
|
45
42
|
"engines": {
|
|
46
43
|
"node": ">=22.0.0"
|
|
47
44
|
},
|
|
48
45
|
"devDependencies": {
|
|
46
|
+
"@types/node": "^22.0.0",
|
|
49
47
|
"typescript": "^5.9.3"
|
|
50
48
|
}
|
|
51
49
|
}
|
package/soundcloud_watcher.ts
CHANGED
|
@@ -75,8 +75,9 @@ interface UserInfo {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
interface FollowerNotification {
|
|
78
|
-
type: 'new' | 'lost';
|
|
78
|
+
type: 'new' | 'lost' | 'renamed';
|
|
79
79
|
users: UserInfo[];
|
|
80
|
+
renames?: { old: UserInfo; new: UserInfo }[]; // Only for type 'renamed'
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
interface AccountNotifications {
|
|
@@ -576,6 +577,19 @@ class AccountWatcher {
|
|
|
576
577
|
const lostFollowers = Object.entries(stored)
|
|
577
578
|
.filter(([uid]) => !currentFollowers[uid])
|
|
578
579
|
.map(([, f]) => f);
|
|
580
|
+
|
|
581
|
+
// Detect name changes for existing followers
|
|
582
|
+
const renames: { old: UserInfo; new: UserInfo }[] = [];
|
|
583
|
+
for (const [uid, current] of Object.entries(currentFollowers)) {
|
|
584
|
+
const prev = stored[uid];
|
|
585
|
+
if (prev) {
|
|
586
|
+
const nameChanged = prev.username !== current.username ||
|
|
587
|
+
prev.display_name !== current.display_name;
|
|
588
|
+
if (nameChanged) {
|
|
589
|
+
renames.push({ old: prev, new: current });
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
579
593
|
|
|
580
594
|
if (newFollowers.length) {
|
|
581
595
|
result.followers.push({ type: 'new', users: newFollowers });
|
|
@@ -583,6 +597,9 @@ class AccountWatcher {
|
|
|
583
597
|
if (lostFollowers.length) {
|
|
584
598
|
result.followers.push({ type: 'lost', users: lostFollowers });
|
|
585
599
|
}
|
|
600
|
+
if (renames.length) {
|
|
601
|
+
result.followers.push({ type: 'renamed', users: [], renames });
|
|
602
|
+
}
|
|
586
603
|
}
|
|
587
604
|
|
|
588
605
|
this.data.my_followers = currentFollowers;
|
|
@@ -974,20 +991,34 @@ export class SoundCloudWatcher {
|
|
|
974
991
|
const users = notif.users.slice(0, 5); // Max 5 users shown
|
|
975
992
|
const remaining = notif.users.length - users.length;
|
|
976
993
|
|
|
994
|
+
// Helper: use display_name if set, otherwise fall back to @username
|
|
995
|
+
const getName = (u: UserInfo) => u.display_name?.trim() || `@${u.username}`;
|
|
996
|
+
|
|
977
997
|
if (notif.type === 'new') {
|
|
978
998
|
lines.push(`New follower${notif.users.length > 1 ? 's' : ''}:`);
|
|
979
999
|
for (const u of users) {
|
|
980
1000
|
if (this.includeLinks && u.permalink_url) {
|
|
981
|
-
lines.push(`- **${u
|
|
1001
|
+
lines.push(`- **${getName(u)}**: ${u.permalink_url}`);
|
|
982
1002
|
} else {
|
|
983
|
-
lines.push(`- **${u
|
|
1003
|
+
lines.push(`- **${getName(u)}**`);
|
|
984
1004
|
}
|
|
985
1005
|
}
|
|
986
|
-
} else {
|
|
1006
|
+
} else if (notif.type === 'lost') {
|
|
987
1007
|
lines.push(`Lost follower${notif.users.length > 1 ? 's' : ''}:`);
|
|
988
1008
|
for (const u of users) {
|
|
989
|
-
lines.push(`- ${u
|
|
1009
|
+
lines.push(`- ${getName(u)}`);
|
|
1010
|
+
}
|
|
1011
|
+
} else if (notif.type === 'renamed' && notif.renames?.length) {
|
|
1012
|
+
const renames = notif.renames.slice(0, 5);
|
|
1013
|
+
const renameRemaining = (notif.renames?.length ?? 0) - renames.length;
|
|
1014
|
+
lines.push(`Name change${renames.length > 1 ? 's' : ''}:`);
|
|
1015
|
+
for (const r of renames) {
|
|
1016
|
+
lines.push(`- ${getName(r.old)} → ${getName(r.new)}`);
|
|
1017
|
+
}
|
|
1018
|
+
if (renameRemaining > 0) {
|
|
1019
|
+
lines.push(` ...and ${renameRemaining} more`);
|
|
990
1020
|
}
|
|
1021
|
+
return lines; // Early return, skip the standard remaining count
|
|
991
1022
|
}
|
|
992
1023
|
|
|
993
1024
|
if (remaining > 0) {
|