瀏覽代碼

added mention to de status message when is a direct message

Pablo Barrera Yaksic 2 月之前
父節點
當前提交
4b080c7359
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/agents/fortune/index.ts

+ 5 - 1
src/agents/fortune/index.ts

@@ -14,7 +14,7 @@ export default class Fortune {
     this._mastodonRestClient = createRestAPIClient({ url: config.MASTODON_API_URL, accessToken });
   }
 
-  private async reply(inReplyToId: string | undefined, user: string, visibility, iteration = 1, count = 1): Promise<void> {
+  private async reply(inReplyToId: string | undefined, user: string, visibility: mastodon.v1.StatusVisibility, iteration = 1, count = 1): Promise<void> {
     let status = "";
     let spoilerText;
     let stop = false;
@@ -61,6 +61,10 @@ export default class Fortune {
         stop = true;
     }
 
+    if (visibility == "direct" && count != 1) {
+      status += `\n@${user}`;
+    }
+
     console.log("Sending status\n", status);
     result = await this._mastodonRestClient.v1.statuses.create({ inReplyToId, spoilerText, status, visibility });