import * as wmill from "https://deno.land/x/windmill@v1.12.0/index.ts";
import { WebClient } from "https://deno.land/x/slack_web_api@1.0.3/mod.ts";

export async function main(
  slack_auth: wmill.Resource<"slack">,
  channel: string = undefined, // Channel to add star to, or channel where the message to add star to was posted (used with timestamp)
  timestamp: string = undefined, // Timestamp of the message to add star to
  file: string = undefined // File to add star to
) {
  const web = new WebClient(slack_auth);

  let response = await web.stars.add({
    channel: channel,
    timestamp: timestamp,
    file: file,
  });

  return { "response": response };
}