#My unmute.js file isn't working

20 messages · Page 1 of 1 (latest)

polar coralBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • ✅ Marked as resolved by OP
viral windBOT
#

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined

  • All SCREAMING_SNAKE_CASE enums have been changed to PascalCase
  • Intents: Intents.FLAGS.GUILD_MESSAGES -> GatewayIntentBits.GuildMessages
  • Permissions: Permissions.FLAGS.SEND_MESSAGES -> PermissionFlagsBits.SendMessages
foggy quartz
#

@opal matrix ^

opal matrix
#

okay.

#

it says when I am trying to unmute somebody that is muted: the user isn't muted.

foggy quartz
#

You just changed it to PermissionsBitField

#

Which isn’t correct either. It’s PermissionFlagsBits

ripe saffron
#

PermissionsBitField.Flags is just fine. But you only did that in the mute command, in the unmute you stopped halfway with the .has check

opal matrix
ripe saffron
#

Your mute code uses the native discord timeout feature. While your unmute code tries to remove a mute role. By an id that isn’t an actual id but text instead

opal matrix
ripe saffron
# opal matrix but what should I add? Do I need database.. etc?

No. You need to make up your mind how you want your command to work.

  • Should it use native discord timeout? Then your unmute should set timeout to null
  • should it use a custom role? Then your unmute should remove that role

Currently you do a mix of both that doesn’t make any sense

chrome scroll
#

mute.js:12 vs unmute.js:10

Ezt a kettőt nézd össze, ha kell olvasd el megint a dokumentációt.
Azt neked kell eldönteni, hogy ranghoz vagy flaghez kötöd a két funkciót.

Ne arra figyelj, hogy mit hallucinál neked az AI .. írj egy sudo kódot mielőtt nekiugrassz.

#
// Ez amit a mute.js-nél használtál.

const member = interaction.options.getMember('target');
member.timeout(60_000); // Egy perces némítás
const member = interaction.options.getMember('target');
member.timeout(null); // Egy perc felülírása == unmute

Remélem így már tiszta.

fervent mural
#

hey there @chrome scroll, this is an english only server. do your best to use a translator, but it doesn’t need to be perfect.

chrome scroll
opal matrix
formal geyser
#

I recommend using Discord's timeouts