add deferReply
to long-duration commands
This commit is contained in:
parent
4005b1b119
commit
6c0f6fcb8b
2 changed files with 6 additions and 2 deletions
|
@ -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!`,
|
||||
|
|
|
@ -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!`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue