Skip to content

Commit 0498a26

Browse files
committed
add success message & defer anyways
1 parent 57b188b commit 0498a26

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

languages/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,7 @@
18721872
"TEMP_MEDIA_PERMS_MISSING_USER": "you forgot to provide a user ya doofus",
18731873
"TEMP_MEDIA_PERMS_ALREADY_HAS": "that user already has permission to attach files & embed links",
18741874
"TEMP_MEDIA_PERMS_REASON": "Given temporary media permissions by {{author}}",
1875+
"TEMP_MEDIA_PERMS_SUCCESS": "Successfully gave temporary media permissions to {{user}} and they'll be removed {{time}} (approximately)",
18751876
"THREADMEMBERUPDATELOG_AUTHOR": "Thread Members Update | {{thread}}",
18761877
"TICKET_COMMAND_DESCRIPTION": "Manage ticket configuration in the server",
18771878
"TICKET_MAIN_DESCRIPTION": "Here are all the ticket configuration commands",

src/commands/Utilities/temp-media-perms.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FireMember } from "@fire/lib/extensions/guildmember";
33
import { Command } from "@fire/lib/util/command";
44
import { Language } from "@fire/lib/util/language";
55
import { PermissionFlagsBits } from "discord-api-types/v9";
6+
import { Formatters } from "discord.js";
67

78
export default class TempMediaPerms extends Command {
89
constructor() {
@@ -23,6 +24,7 @@ export default class TempMediaPerms extends Command {
2324
enableSlashCommand: true,
2425
restrictTo: "guild",
2526
moderatorOnly: true,
27+
deferAnyways: true,
2628
slashOnly: true,
2729
ephemeral: true,
2830
});
@@ -49,7 +51,8 @@ export default class TempMediaPerms extends Command {
4951
)
5052
.catch(() => {});
5153
if (!added) return await command.error("COMMAND_ERROR_500");
52-
else
54+
else {
55+
const timestamp = +new Date() + 120_000;
5356
setTimeout(() => {
5457
args.user.roles.remove(
5558
role,
@@ -58,5 +61,10 @@ export default class TempMediaPerms extends Command {
5861
})
5962
);
6063
}, 120_000);
64+
return await command.success("TEMP_MEDIA_PERMS_SUCCESS", {
65+
user: args.user.toString(),
66+
time: Formatters.time(new Date(timestamp), "R"),
67+
});
68+
}
6169
}
6270
}

0 commit comments

Comments
 (0)