add deferReply to long-duration commands

This commit is contained in:
Ryan Cao 2022-08-25 20:42:37 +08:00
parent 4005b1b119
commit 6c0f6fcb8b
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
2 changed files with 6 additions and 2 deletions

View file

@ -3,10 +3,12 @@ import type { CacheType, CommandInteraction } from 'discord.js';
import { COLORS } from '../constants';
export const membersCommand = async (i: CommandInteraction<CacheType>) => {
await i.deferReply();
const memes = await i.guild?.members.fetch().then((r) => r.toJSON());
if (!memes) return;
await i.reply({
await i.editReply({
embeds: [
{
title: `${memes.length} total members!`,

View file

@ -2,11 +2,13 @@ import type { CacheType, CommandInteraction } from 'discord.js';
import { COLORS } from '../constants';
export const starsCommand = async (i: CommandInteraction<CacheType>) => {
await i.deferReply();
const count = await fetch('https://api.github.com/repos/PolyMC/PolyMC')
.then((r) => r.json() as Promise<{ stargazers_count: number }>)
.then((j) => j.stargazers_count);
await i.reply({
await i.editReply({
embeds: [
{
title: `${count} total stars!`,