Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nmagedman committed Jan 15, 2025
1 parent 4565429 commit 71d053d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Meteor.startup(async () => {
function perform() {
const slack = new Slack(SLACK_TOKEN);

const keyword = 'substack';
const keyword = TERMS_TO_MONITOR[0]; // Just search for one keyword for now. TODO: Search for all keywords
const docs = aggregateMessagesContainingKeyword(keyword, yesterday());
const tsv = generateTSV(docs);
sendReportToSlack(tsv, slack);
Expand Down Expand Up @@ -145,6 +145,12 @@ function buildMongoPipelineArray(matchDoc) {
// Docs: https://api.slack.com/methods/chat.postMessage

function sendReportToSlack(tsv, slack) {
// post_attachments(channel_id, attachments, initial_comment)
slack.sendMessage(data) => json
const attachments = [
{
filename: "test.tsv",
content: tsv,
}
];

slack.post_attachments(SLACK_CHANNEL_ID, attachments, "This is the initial comment");
}
2 changes: 1 addition & 1 deletion apps/meteor/app/seeking-alpha/utils/Slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { Logger } from '@rocket.chat/logger';
import { WebClient as SlackWebAPIClient } from '@slack/web-api';

import { SlackAPI as RocketChatSlackbridgeAPI} from '../../slackbridge/server/SlackAPI';
import { SlackAPI as RocketChatSlackbridgeAPI } from '../../slackbridge/server/SlackAPI';

export default class Slack {
constructor(apiOrBotToken) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/server/importPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ import '../app/reactions/server';
import '../app/livechat/server';
import '../app/authentication/server';
import '../app/voip/server/startup';
import '../app/seeking-alpha/term-of-use-violations/server';
import '../app/seeking-alpha/terms-of-use-violations';

0 comments on commit 71d053d

Please sign in to comment.