Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.

Commit 9dea01b

Browse files
authored
fix: discord warning ephemeral deprecated (#103)
This pull request refactors how ephemeral replies are handled across multiple Discord bot commands. Instead of using the `ephemeral: true` property, replies are now set as ephemeral using the `flags: MessageFlags.Ephemeral` property. This change ensures consistency with the latest Discord.js API and improves maintainability. Additionally, the deployment workflow is temporarily disabled. ### Discord Command Refactoring **Ephemeral Reply Property Update:** * Replaced all instances of `ephemeral: true` with `flags: MessageFlags.Ephemeral` in reply calls across command files. This change ensures replies are correctly marked as ephemeral using the recommended Discord.js approach. ### Workflow Update **Deployment Workflow Disabled:** * Temporarily disabled the deployment workflow by setting `if: false` in `.github/workflows/deploy.yml` due to the absence of Azure and pending server stability.
1 parent 296b71c commit 9dea01b

23 files changed

Lines changed: 327 additions & 318 deletions

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
jobs:
1414
deploy:
1515
runs-on: ubuntu-latest
16+
if: false # We don't have AZ anymore, so disable until we have a stable server
1617
steps:
1718
- name: Checkout
1819
uses: actions/checkout@v3

src/commands/badge/badge_redeem.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GuildMember, SlashCommandBuilder } from 'discord.js'
1+
import { GuildMember, MessageFlags, SlashCommandBuilder } from 'discord.js'
22
import { Command } from '@/types'
33
import { BADGE_SET } from '@/defines/commands.json'
44
import { CODE_OPTION, REPLY_SUCCESS, REPLY_ERROR } from '-/commands/badge_redeem.json'
@@ -34,13 +34,13 @@ export const useBadgeRedeem = (): Command => {
3434

3535
await interaction.reply({
3636
content: REPLY_SUCCESS,
37-
ephemeral: true,
37+
flags: MessageFlags.Ephemeral,
3838
})
3939
})
4040
.catch(async () => {
4141
await interaction.reply({
4242
content: REPLY_ERROR,
43-
ephemeral: true,
43+
flags: MessageFlags.Ephemeral,
4444
})
4545
})
4646
},

src/commands/color.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CommandInteractionOption, GuildMember, HexColorString, SlashCommandBuilder } from 'discord.js'
1+
import { CommandInteractionOption, GuildMember, HexColorString, MessageFlags, SlashCommandBuilder } from 'discord.js'
22
import { Command } from '@/types'
33
import { COLOR } from '@/defines/commands.json'
44
import { RESTRICTED_CUSTOM_ROLE_COLORS } from '@/defines/values.json'
@@ -35,13 +35,13 @@ export const useColor = (): Command => {
3535
}
3636

3737
if (!isHex(color)) {
38-
await interaction.reply({ content: HEX_ERROR, ephemeral: true })
38+
await interaction.reply({ content: HEX_ERROR, flags: MessageFlags.Ephemeral })
3939

4040
return
4141
}
4242

4343
if (RESTRICTED_CUSTOM_ROLE_COLORS.some((v) => v === color)) {
44-
await interaction.reply({ content: HEX_ERROR_IN_SPECIFIC_COLORS, ephemeral: true })
44+
await interaction.reply({ content: HEX_ERROR_IN_SPECIFIC_COLORS, flags: MessageFlags.Ephemeral })
4545

4646
return
4747
}

src/commands/daily.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GuildMember, SlashCommandBuilder } from 'discord.js'
1+
import { GuildMember, MessageFlags, SlashCommandBuilder } from 'discord.js'
22
import { Command, DailyPOST } from '@/types'
33
import { DAILY } from '@/defines/commands.json'
44
import { isPresentedMember, isPrivilegedMember, reply } from '@/utils'
@@ -29,7 +29,7 @@ export const useDaily = (): Command => {
2929
if (lastRedeem >= actuallyTime) {
3030
await interaction.reply({
3131
content: HCOINS_ERROR,
32-
ephemeral: true,
32+
flags: MessageFlags.Ephemeral,
3333
})
3434

3535
return

src/commands/dynamic_voice/dynamic_voice_create.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CategoryChannel, ChannelType, GuildMember, SlashCommandBuilder } from 'discord.js'
1+
import { CategoryChannel, ChannelType, GuildMember, MessageFlags, SlashCommandBuilder } from 'discord.js'
22
import { Command } from '@/types'
33
import { DYNAMIC_VOICE } from '@/defines/commands.json'
44
import { DYNAMIC_CATEGORY_CHANNEL } from '@/defines/ids.json'
@@ -72,7 +72,7 @@ export const useDynamicVoice = (): Command => {
7272
: getOptionType(DYNAMIC_VOICE_OPTIONS, type.value as number)
7373

7474
if (member?.voice?.channel?.parent?.id === DYNAMIC_CATEGORY_CHANNEL.id) {
75-
await interaction.reply({ content: IN_DYNAMIC_VOICE_ERROR, ephemeral: true })
75+
await interaction.reply({ content: IN_DYNAMIC_VOICE_ERROR, flags: MessageFlags.Ephemeral })
7676

7777
return
7878
}
@@ -100,7 +100,7 @@ export const useDynamicVoice = (): Command => {
100100
color: 'success',
101101
})
102102

103-
await interaction.reply({ content: invite.url, ephemeral: true }).catch(() => {
103+
await interaction.reply({ content: invite.url, flags: MessageFlags.Ephemeral }).catch(() => {
104104
client.logger.emit({
105105
message: `${getTargetMember(member)} não conseguiu criar o canal de voz dinâmico **${typeTitle}**!`,
106106
type: 'command',

src/commands/judge.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
ButtonInteraction,
55
ButtonStyle,
66
GuildMember,
7+
MessageFlags,
78
SlashCommandBuilder,
89
} from 'discord.js'
910
import { Command, He4rtClient } from '@/types'
@@ -46,7 +47,7 @@ export const useJudge = (): Command => {
4647
if ((reason.value as string).length >= DISCORD_MESSAGE_LIMIT) {
4748
await interaction.reply({
4849
content: `O seu texto de motivo ultrapassa o limite do discord (${DISCORD_MESSAGE_LIMIT} caracteres) e por isso foi desconsiderado! Opte por enviar feedback's separados!`,
49-
ephemeral: true,
50+
flags: MessageFlags.Ephemeral,
5051
})
5152

5253
return

src/commands/medal/medal_add.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GuildMember, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js'
1+
import { GuildMember, MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js'
22
import { Command, Maybe } from '@/types'
33
import { MEDAL_ADD } from '@/defines/commands.json'
44
import { MEDAL_OPTION, MEMBER_OPTION, DO_NOT_HAVE, SUCCESS } from '-/commands/medal.json'
@@ -31,7 +31,7 @@ export const useMedalAdd = (): Command => {
3131

3232
addUserInMedal(client, { id: member.id, role_id: medal_id, expires_at })
3333
.then(async () => {
34-
await interaction.reply({ content: SUCCESS, ephemeral: true })
34+
await interaction.reply({ content: SUCCESS, flags: MessageFlags.Ephemeral })
3535
})
3636
.catch(async () => {
3737
await reply(interaction).error()

src/commands/medal/medal_set.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GuildMember, SlashCommandBuilder } from 'discord.js'
1+
import { GuildMember, MessageFlags, SlashCommandBuilder } from 'discord.js'
22
import { Command } from '@/types'
33
import { MEDAL } from '@/defines/commands.json'
44
import { MEDAL_OPTION, DO_NOT_HAVE, ALREADY, SUCCESS } from '-/commands/medal.json'
@@ -23,13 +23,13 @@ export const useMedal = (): Command => {
2323
const userHasMedal = await hasMedal(client, { id: member.id, role_id: medal_id })
2424

2525
if (!userHasMedal) {
26-
await interaction.reply({ content: DO_NOT_HAVE, ephemeral: true })
26+
await interaction.reply({ content: DO_NOT_HAVE, flags: MessageFlags.Ephemeral })
2727

2828
return
2929
}
3030

3131
if (hasRole(member, medal_id)) {
32-
await interaction.reply({ content: ALREADY, ephemeral: true })
32+
await interaction.reply({ content: ALREADY, flags: MessageFlags.Ephemeral })
3333

3434
return
3535
}
@@ -41,7 +41,7 @@ export const useMedal = (): Command => {
4141
.remove(medals.filter(({ role_id }) => role_id !== medal_id).map((role) => role.role_id))
4242
.catch(() => {})
4343

44-
await interaction.reply({ content: SUCCESS, ephemeral: true })
44+
await interaction.reply({ content: SUCCESS, flags: MessageFlags.Ephemeral })
4545
})
4646
.catch(async () => {
4747
await reply(interaction).error()
Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
import { GuildMember, SlashCommandBuilder } from 'discord.js'
2-
import { Command } from '@/types'
3-
import { ONBOARDING_VOLUNTARY } from '@/defines/commands.json'
4-
import { VOLUNTEER_CHANNEL, VOLUNTEER_ROLE } from '@/defines/ids.json'
5-
import { getTargetMember, isPresentedMember, isVoluntaryMember, reply } from '@/utils'
6-
7-
export const useOnboardingVoluntary = (): Command => {
8-
const data = new SlashCommandBuilder()
9-
.setName(ONBOARDING_VOLUNTARY.TITLE)
10-
.setDescription(ONBOARDING_VOLUNTARY.DESCRIPTION)
11-
.setDMPermission(false)
12-
13-
return [
14-
data,
15-
async (interaction, client) => {
16-
const possibleVolunteer = interaction.member as GuildMember
17-
18-
if (!isPresentedMember(possibleVolunteer)) {
19-
await reply(interaction).errorMemberIsNotPresented()
20-
21-
return
22-
}
23-
24-
if (isVoluntaryMember(possibleVolunteer)) {
25-
await reply(interaction).error()
26-
27-
return
28-
}
29-
30-
// TODO: onboarding explanation and confirm
31-
32-
// TODO: choice of ideal time (morning, afternoon, evening)
33-
34-
await possibleVolunteer.roles.add(VOLUNTEER_ROLE.id)
35-
36-
client.logger.emit({
37-
message: `${getTargetMember(possibleVolunteer)} se tornou um voluntário!`,
38-
type: 'command',
39-
color: 'success',
40-
})
41-
42-
await interaction.reply({
43-
content: `**Agora você é um voluntário!** Fique atento ao canal <#${VOLUNTEER_CHANNEL.id}> para atender as pessoas que solicitarem ajuda.\n\nLembre-se de usar o comando **/onboarding-finalizar** quando acabar de ajuda alguém.`,
44-
ephemeral: true,
45-
})
46-
},
47-
]
48-
}
1+
import { GuildMember, MessageFlags, SlashCommandBuilder } from 'discord.js'
2+
import { Command } from '@/types'
3+
import { ONBOARDING_VOLUNTARY } from '@/defines/commands.json'
4+
import { VOLUNTEER_CHANNEL, VOLUNTEER_ROLE } from '@/defines/ids.json'
5+
import { getTargetMember, isPresentedMember, isVoluntaryMember, reply } from '@/utils'
6+
7+
export const useOnboardingVoluntary = (): Command => {
8+
const data = new SlashCommandBuilder()
9+
.setName(ONBOARDING_VOLUNTARY.TITLE)
10+
.setDescription(ONBOARDING_VOLUNTARY.DESCRIPTION)
11+
.setDMPermission(false)
12+
13+
return [
14+
data,
15+
async (interaction, client) => {
16+
const possibleVolunteer = interaction.member as GuildMember
17+
18+
if (!isPresentedMember(possibleVolunteer)) {
19+
await reply(interaction).errorMemberIsNotPresented()
20+
21+
return
22+
}
23+
24+
if (isVoluntaryMember(possibleVolunteer)) {
25+
await reply(interaction).error()
26+
27+
return
28+
}
29+
30+
// TODO: onboarding explanation and confirm
31+
32+
// TODO: choice of ideal time (morning, afternoon, evening)
33+
34+
await possibleVolunteer.roles.add(VOLUNTEER_ROLE.id)
35+
36+
client.logger.emit({
37+
message: `${getTargetMember(possibleVolunteer)} se tornou um voluntário!`,
38+
type: 'command',
39+
color: 'success',
40+
})
41+
42+
await interaction.reply({
43+
content: `**Agora você é um voluntário!** Fique atento ao canal <#${VOLUNTEER_CHANNEL.id}> para atender as pessoas que solicitarem ajuda.\n\nLembre-se de usar o comando **/onboarding-finalizar** quando acabar de ajuda alguém.`,
44+
flags: MessageFlags.Ephemeral,
45+
})
46+
},
47+
]
48+
}
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { SlashCommandBuilder } from 'discord.js'
2-
import { Command } from '@/types'
3-
import { ONBOARDING_WHY } from '@/defines/commands.json'
4-
5-
export const useOnboardingWhy = (): Command => {
6-
const data = new SlashCommandBuilder()
7-
.setName(ONBOARDING_WHY.TITLE)
8-
.setDescription(ONBOARDING_WHY.DESCRIPTION)
9-
.setDMPermission(false)
10-
11-
return [
12-
data,
13-
async (interaction, client) => {
14-
await interaction.reply({
15-
content:
16-
'O nosso sistema de **onboarding** serve como uma ajuda direcionada a novos membros no servidor e que desejam conhecer nossa iniciativa e participar mais ativamente dela. Para isso, temos os seguintes comandos à disposição:\n\n**/onboarding-requisitar**: Requisite uma ajuda especial aos nossos **voluntários**, alertando-os de que você deseja um *tour* por nosso servidor.\n\n**/onboarding-voluntariar**: Se torne um **voluntário** e receba novos membros na comunidade (sendo recompensado por isso).\n\n**/onboarding-finalizar**: Caso você seja um **voluntário** e tenha terminado uma ajuda, use este comando para receber pontos extras no servidor!\n\n**/onboarding-desistir**: Use este comando caso deseje não ser mais um **voluntário**.\n\n**ATENÇÃO: Este sistema funciona de forma assíncrona, ou seja, se você requisitar uma ajuda, não quer dizer que aparecerá alguém de imediato para a sua requisição!**',
17-
ephemeral: true,
18-
})
19-
},
20-
]
21-
}
1+
import { MessageFlags, SlashCommandBuilder } from 'discord.js'
2+
import { Command } from '@/types'
3+
import { ONBOARDING_WHY } from '@/defines/commands.json'
4+
5+
export const useOnboardingWhy = (): Command => {
6+
const data = new SlashCommandBuilder()
7+
.setName(ONBOARDING_WHY.TITLE)
8+
.setDescription(ONBOARDING_WHY.DESCRIPTION)
9+
.setDMPermission(false)
10+
11+
return [
12+
data,
13+
async (interaction, client) => {
14+
await interaction.reply({
15+
content:
16+
'O nosso sistema de **onboarding** serve como uma ajuda direcionada a novos membros no servidor e que desejam conhecer nossa iniciativa e participar mais ativamente dela. Para isso, temos os seguintes comandos à disposição:\n\n**/onboarding-requisitar**: Requisite uma ajuda especial aos nossos **voluntários**, alertando-os de que você deseja um *tour* por nosso servidor.\n\n**/onboarding-voluntariar**: Se torne um **voluntário** e receba novos membros na comunidade (sendo recompensado por isso).\n\n**/onboarding-finalizar**: Caso você seja um **voluntário** e tenha terminado uma ajuda, use este comando para receber pontos extras no servidor!\n\n**/onboarding-desistir**: Use este comando caso deseje não ser mais um **voluntário**.\n\n**ATENÇÃO: Este sistema funciona de forma assíncrona, ou seja, se você requisitar uma ajuda, não quer dizer que aparecerá alguém de imediato para a sua requisição!**',
17+
flags: MessageFlags.Ephemeral,
18+
})
19+
},
20+
]
21+
}

0 commit comments

Comments
 (0)