Edits history of script submission #23048 for ' Set User Status (slack)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { WebClient } from "@slack/web-api"
    
    /**
     * Set User Status
     * Set the connected user's status. `status_emoji` is an emoji with colons, e.g. ":palm_tree:". `status_expiration` is a Unix timestamp in seconds; 0 or empty keeps the status until changed. Empty text and emoji clear the status. Requires a user token with users.profile:write.
     */
    export async function main(
      auth: RT.Slack,
      status_text?: string,
      status_emoji?: string,
      status_expiration?: number
    ) {
      const client = new WebClient(auth.token)
      return await client.users.profile.set({
        profile: {
          status_text: status_text ?? "",
          status_emoji: status_emoji ?? "",
          status_expiration: status_expiration ?? 0,
        },
      })
    }
    

    Submitted by hugo989 2 hours ago