feat(notifications): Add bot owner notifications for interactions
- Create new botOwnerNotify module with notifyBotOwnerForPost and notifyBotOwnerForFollow functions - Add bot owner notifications to local post interactions (likes, reposts) - Add bot owner notifications to swarm post interactions (likes, reposts, mentions) - Add bot owner notifications to follow interactions (local and swarm) - Implement mention notification creation for local mentions in post creation - Notify bot owners when their bots receive interactions from other users - Ensure bot owners are alerted to engagement on their bot accounts across federated network
This commit is contained in:
@@ -110,6 +110,10 @@ export async function POST(request: NextRequest) {
|
||||
type: 'follow',
|
||||
});
|
||||
|
||||
// Also notify bot owner if this is a bot being followed
|
||||
const { notifyBotOwnerForFollow } = await import('@/lib/notifications/botOwnerNotify');
|
||||
await notifyBotOwnerForFollow(targetUser.id, remoteUser.id);
|
||||
|
||||
console.log(`[Swarm] Received follow from ${remoteHandle} for @${data.targetHandle}`);
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
@@ -84,6 +84,10 @@ export async function POST(request: NextRequest) {
|
||||
type: 'like',
|
||||
});
|
||||
|
||||
// Also notify bot owner if this is a bot's post
|
||||
const { notifyBotOwnerForPost } = await import('@/lib/notifications/botOwnerNotify');
|
||||
await notifyBotOwnerForPost(post.userId, remoteUser.id, 'like', data.postId);
|
||||
|
||||
console.log(`[Swarm] Received like from ${remoteHandle} on post ${data.postId}`);
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
@@ -94,6 +94,10 @@ export async function POST(request: NextRequest) {
|
||||
type: 'mention',
|
||||
});
|
||||
|
||||
// Also notify bot owner if this is a bot being mentioned
|
||||
const { notifyBotOwnerForPost } = await import('@/lib/notifications/botOwnerNotify');
|
||||
await notifyBotOwnerForPost(mentionedUser.id, remoteUser.id, 'mention', post.id);
|
||||
|
||||
console.log(`[Swarm] Received mention from ${remoteHandle} for @${data.mentionedHandle}`);
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
@@ -79,6 +79,10 @@ export async function POST(request: NextRequest) {
|
||||
type: 'repost',
|
||||
});
|
||||
|
||||
// Also notify bot owner if this is a bot's post
|
||||
const { notifyBotOwnerForPost } = await import('@/lib/notifications/botOwnerNotify');
|
||||
await notifyBotOwnerForPost(post.userId, remoteUser.id, 'repost', data.postId);
|
||||
|
||||
console.log(`[Swarm] Received repost from ${remoteHandle} on post ${data.postId}`);
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
Reference in New Issue
Block a user