Skip to content

Commit

Permalink
feat(commands): specify which user sent a message command
Browse files Browse the repository at this point in the history
  • Loading branch information
D4isDAVID committed Sep 19, 2024
1 parent 80e28a2 commit 1482fec
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/components/qbox/commands/support/message-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
InteractionContextType,
MessageFlags,
} from '@discordjs/core';
import { messageLink } from '@discordjs/formatters';
import { messageLink, subtext, userMention } from '@discordjs/formatters';
import { supportMessage } from './message.js';
import { MessageCommand } from '/components/types.js';

Expand All @@ -21,10 +21,14 @@ export const supportMessageCommand = {
flags: MessageFlags.Ephemeral,
});

const user = interaction.user ?? interaction.member!.user;
const message = await api.channels.createMessage(
interaction.channel.id,
{
content: supportMessage,
content: [
supportMessage,
subtext(`Sent by ${userMention(user.id)}`),
].join('\n'),
message_reference: { message_id: interaction.data.target_id },
},
);
Expand Down
8 changes: 6 additions & 2 deletions src/components/utility/commands/plshelp/message-command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApplicationCommandType, MessageFlags } from '@discordjs/core';
import { messageLink } from '@discordjs/formatters';
import { messageLink, subtext, userMention } from '@discordjs/formatters';
import { plshelpMessage } from './message.js';
import { MessageCommand } from '/components/types.js';

Expand All @@ -13,10 +13,14 @@ export const plshelpMessageCommand = {
flags: MessageFlags.Ephemeral,
});

const user = interaction.user ?? interaction.member!.user;
const message = await api.channels.createMessage(
interaction.channel.id,
{
content: plshelpMessage(),
content: [
plshelpMessage(),
subtext(`Sent by ${userMention(user.id)}`),
].join('\n'),
message_reference: { message_id: interaction.data.target_id },
},
);
Expand Down
8 changes: 6 additions & 2 deletions src/components/utility/commands/spoonfeed/message-command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApplicationCommandType, MessageFlags } from '@discordjs/core';
import { messageLink } from '@discordjs/formatters';
import { messageLink, subtext, userMention } from '@discordjs/formatters';
import { spoonfeedMessage } from './message.js';
import { MessageCommand } from '/components/types.js';

Expand All @@ -13,10 +13,14 @@ export const spoonfeedMessageCommand = {
flags: MessageFlags.Ephemeral,
});

const user = interaction.user ?? interaction.member!.user;
const message = await api.channels.createMessage(
interaction.channel.id,
{
content: spoonfeedMessage(),
content: [
spoonfeedMessage(),
subtext(`Sent by ${userMention(user.id)}`),
].join('\n'),
message_reference: { message_id: interaction.data.target_id },
},
);
Expand Down

0 comments on commit 1482fec

Please sign in to comment.