mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-23 20:07:35 -05:00
not EPHEMERAL because no embeds
This commit is contained in:
parent
0d7188a497
commit
4e3364bda7
|
|
@ -1,12 +1,9 @@
|
|||
import getEmbed from "discord/embed";
|
||||
import { weaponsToEmoji } from "discord/emoji";
|
||||
import { RespondData } from "discord/utils";
|
||||
import { RespondFuction } from "discord/utils";
|
||||
import { getUserByIdentifier } from "prisma/queries/getUserByIdentifier";
|
||||
|
||||
const infoCommand = async (
|
||||
respond: (result: RespondData) => void,
|
||||
discordId: string
|
||||
) => {
|
||||
const infoCommand = async (respond: RespondFuction, discordId: string) => {
|
||||
const user = await getUserByIdentifier(discordId);
|
||||
|
||||
if (!user) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import infoCommand from "./commands/info";
|
||||
import { InteractionInfo, InvocationCommon, RespondData } from "./utils";
|
||||
import { InteractionInfo, InvocationCommon, RespondFuction } from "./utils";
|
||||
|
||||
const handleCommand = async (
|
||||
interaction: InvocationCommon & InteractionInfo,
|
||||
respond: (result: RespondData) => void
|
||||
respond: RespondFuction
|
||||
) => {
|
||||
switch (interaction.data.name) {
|
||||
case "ping":
|
||||
|
|
|
|||
|
|
@ -27,3 +27,5 @@ export type RespondData = {
|
|||
content?: string;
|
||||
embeds?: Embed[];
|
||||
};
|
||||
|
||||
export type RespondFuction = (result: RespondData) => void;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import handleCommand from "discord";
|
||||
import {
|
||||
InteractionResponseFlags,
|
||||
InteractionResponseType,
|
||||
InteractionType,
|
||||
} from "discord-interactions";
|
||||
import { InteractionResponseType, InteractionType } from "discord-interactions";
|
||||
import { RespondData } from "discord/utils";
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import getRawBody from "raw-body";
|
||||
|
|
@ -43,7 +39,7 @@ const discordCommandHandler = async (
|
|||
if (interaction && interaction.type === InteractionType.COMMAND) {
|
||||
handleCommand(interaction, (data) =>
|
||||
res.status(200).json({
|
||||
type: InteractionResponseType.CHANNEL_MESSAGE,
|
||||
type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
|
||||
data: getCompleteData(data),
|
||||
})
|
||||
);
|
||||
|
|
@ -59,7 +55,7 @@ function getCompleteData(result: RespondData) {
|
|||
...result,
|
||||
// add zero-width space because empty content isn't allowed even with embeds
|
||||
content: result.content ? result.content : "\u200b",
|
||||
flags: InteractionResponseFlags.EPHEMERAL,
|
||||
//flags: InteractionResponseFlags.EPHEMERAL,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user