Skip to content

Commit ee63f02

Browse files
committed
feat: Use defer for ip command
1 parent d48d7b4 commit ee63f02

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • src/commands/chatInput

src/commands/chatInput/ip.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ import type { IPInfoResult } from "#typings";
77

88
export default new ChatInputCommand({
99
async run(app, interaction, options) {
10+
await app.api.interactions.defer(interaction.id, interaction.token);
11+
1012
const ip = options.getString("ip", true);
1113
const res = await fetch(process.env.IP_INFO_URL! + ip, { headers: { "User-Agent": process.env.IP_INFO_USER_AGENT! } });
1214
const result: IPInfoResult = await res.json();
1315
let content = subtext(`${formatString(result.status)} - ${result.description}`);
1416

1517
if (result.data) content += "\n" + codeBlock("js", format("%O", result.data.geo).slice(0, 1990));
1618

17-
await app.api.interactions.reply(interaction.id, interaction.token, { content, flags: app.ephemeral });
19+
await app.api.interactions.editReply(process.env.CLIENT_ID!, interaction.token, { content, flags: app.ephemeral });
1820
},
1921
data: {
2022
name: "ip",

0 commit comments

Comments
 (0)