From 088de871f7ede0ba8ff22a670ad79a15a94c1620 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:49:58 +0700 Subject: [PATCH] feat: report message client.api.reporting.menu.message.get({ query: { variant: 4, }, }); --- src/structures/Message.js | 28 ++++++++++++++++++++++++++++ typings/index.d.ts | 5 ++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index d0d72e1..c3892a8 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -1201,6 +1201,34 @@ class Message extends Base { }, }); } + + /** + * Report Message + * @param {Arrray} breadcrumbs Options for reporting + * @param {Object} [elements={}] Metadata + * @returns {Promise<{ report_id: Snowflake }>} + * @example + * // Report Category + * // - MESSAGE_WELCOME (3) + * // - Something else (28) + * // - Hacks, cheats, phishing or malicious links (72) + * message.report([3, 28, 72]).then(console.log); + * // { "report_id": "1199663489988440124" } + */ + report(breadcrumbs, elements = {}) { + return this.client.api.reporting.message.post({ + data: { + version: '1.0', + variant: '4', + language: 'en', + breadcrumbs, + elements, + channel_id: this.channelId, + message_id: this.id, + name: 'message', + }, + }); + } } exports.Message = Message; diff --git a/typings/index.d.ts b/typings/index.d.ts index 8f26a5c..fc52ce7 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1895,6 +1895,7 @@ export class Message extends Base { ): Promise; public markUnread(): Promise; public markRead(): Promise; + public report(breadcrumbs: number[], elements?: object): Promise<{ report_id: Snowflake }>; } export class CallState extends Base { @@ -3805,9 +3806,7 @@ export interface CustomStatusOption { status?: PresenceStatusData | null; } -/** - * @see {@link https://luna.gitlab.io/discord-unofficial-docs/user_settings.html} - */ +// Source: https://luna.gitlab.io/discord-unofficial-docs/user_settings.html export interface RawUserSettingsData { afk_timeout?: number; allow_accessibility_detection?: boolean;