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';
|
import { COLORS } from '../constants';
|
||||||
|
|
||||||
export const membersCommand = async (i: CommandInteraction<CacheType>) => {
|
export const membersCommand = async (i: CommandInteraction<CacheType>) => {
|
||||||
|
await i.deferReply();
|
||||||
|
|
||||||
const memes = await i.guild?.members.fetch().then((r) => r.toJSON());
|
const memes = await i.guild?.members.fetch().then((r) => r.toJSON());
|
||||||
if (!memes) return;
|
if (!memes) return;
|
||||||
|
|
||||||
await i.reply({
|
await i.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: `${memes.length} total members!`,
|
title: `${memes.length} total members!`,
|
||||||
|
|
|
@ -2,11 +2,13 @@ import type { CacheType, CommandInteraction } from 'discord.js';
|
||||||
import { COLORS } from '../constants';
|
import { COLORS } from '../constants';
|
||||||
|
|
||||||
export const starsCommand = async (i: CommandInteraction<CacheType>) => {
|
export const starsCommand = async (i: CommandInteraction<CacheType>) => {
|
||||||
|
await i.deferReply();
|
||||||
|
|
||||||
const count = await fetch('https://api.github.com/repos/PolyMC/PolyMC')
|
const count = await fetch('https://api.github.com/repos/PolyMC/PolyMC')
|
||||||
.then((r) => r.json() as Promise<{ stargazers_count: number }>)
|
.then((r) => r.json() as Promise<{ stargazers_count: number }>)
|
||||||
.then((j) => j.stargazers_count);
|
.then((j) => j.stargazers_count);
|
||||||
|
|
||||||
await i.reply({
|
await i.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: `⭐ ${count} total stars!`,
|
title: `⭐ ${count} total stars!`,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue