mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-03-29 09:19:54 +00:00
report apps
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
reportUserPut,
|
||||
reportGuildPut,
|
||||
reportGuildDiscovery,
|
||||
reportApplicationPut,
|
||||
} from "./types.js";
|
||||
interface InfoMap {
|
||||
message?: Message;
|
||||
@@ -26,6 +27,7 @@ interface InfoMap {
|
||||
guild?: Guild;
|
||||
guild_id?: string;
|
||||
dyn_preview?: () => HTMLElement;
|
||||
application_id?: string;
|
||||
}
|
||||
export class ReportMenu {
|
||||
variant: string;
|
||||
@@ -153,6 +155,17 @@ export class ReportMenu {
|
||||
realBody = m;
|
||||
break;
|
||||
}
|
||||
case "application": {
|
||||
const id = this.infoMap.application_id;
|
||||
if (!id) throw new Error("id expected");
|
||||
const m: reportApplicationPut = {
|
||||
...obj,
|
||||
name: "application",
|
||||
application_id: id,
|
||||
};
|
||||
realBody = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const res = await fetch(this.postback_url, {
|
||||
method: "POST",
|
||||
@@ -300,7 +313,8 @@ class ReportNode {
|
||||
if (
|
||||
this.buttonType !== "cancel" &&
|
||||
this.buttonType !== "done" &&
|
||||
!this.elements.find((e) => e.json.type === "skip")
|
||||
!this.elements.find((e) => e.json.type === "skip") &&
|
||||
this.owner.nodes.length
|
||||
) {
|
||||
const back = document.createElement("button");
|
||||
back.textContent = I18n.report.back();
|
||||
|
||||
@@ -275,7 +275,7 @@ interface reportGuildEventPut extends reportPut {
|
||||
guild_scheduled_event_id: string;
|
||||
name: "guild_scheduled_event";
|
||||
}
|
||||
interface reportApplicationPut extends reportPut {
|
||||
export interface reportApplicationPut extends reportPut {
|
||||
application_id: string;
|
||||
name: "application";
|
||||
}
|
||||
|
||||
@@ -567,6 +567,23 @@ class User extends SnowFlake {
|
||||
color: "red",
|
||||
},
|
||||
);
|
||||
this.contextmenu.addButton(
|
||||
() => I18n.user.reportApp(),
|
||||
async function (member) {
|
||||
const menu = await ReportMenu.makeReport("application", this.localuser, {
|
||||
user: this,
|
||||
member,
|
||||
});
|
||||
menu?.spawnMenu();
|
||||
},
|
||||
{
|
||||
visible: function () {
|
||||
const settings = getDeveloperSettings();
|
||||
return this.bot && settings.reportSystem;
|
||||
},
|
||||
color: "red",
|
||||
},
|
||||
);
|
||||
|
||||
this.contextmenu.addButton(
|
||||
() => I18n.user.instanceBan(),
|
||||
|
||||
@@ -811,6 +811,7 @@
|
||||
"usedFermi": "Used Fermi",
|
||||
"user": {
|
||||
"report":"Report user",
|
||||
"reportApp":"Report Application",
|
||||
"addRole": "Add roles",
|
||||
"ban": "Ban member",
|
||||
"block": "Block user",
|
||||
|
||||
Reference in New Issue
Block a user