#Hepl me pls

1 messages · Page 1 of 1 (latest)

dreamy iris
#

Bro I want to add a announcement command and I'm looking for days to make it. I used AI and it didn't work

wind wraithBOT
still yew
#

-_-

#

@karmic needle

cursive frost
alpine rivet
#

You keep ignoring

dreamy iris
#

This is the member count command

#

/membercount from your bots code

#

All In One version 1

alpine rivet
# dreamy iris Ok here you go
const {
  SlashCommandBuilder,
  ContainerBuilder,
  TextDisplayBuilder,
  SeparatorBuilder,
  MessageFlags,
  SeparatorSpacingSize,
  PermissionFlagBits,
  ChannelType,
} = require("discord.js");

module.exports = {
  data: new SlashCommandBuilder()
    .setName("announcement")
    .setDescription("Make an announcement in the server.")
    .addStringOption((option) =>
      option
        .setName("message")
        .setDescription("The announcement message")
        .setRequired(true)
    )
    .addChannelOption((option) =>
      option
        .setName("channel")
        .setDescription("The channel to send the announcement to")
        .addChannelTypes(ChannelType.GuildText)
        .setRequired(false)
    )
    .setDefaultMemberPermissions(PermissionFlagBits.ManageMessages),

  async execute(interaction, client) {
    const message = interaction.options.getString("message");
    const channel = interaction.options.getChannel("channel") || interaction.channel;

    const container = new ContainerBuilder();

    container.addTextDisplayComponents(
      new TextDisplayBuilder().setContent("## 📢 Announcement")
    );

    container.addSeparatorComponents(
      new SeparatorBuilder().setSpacing(SeparatorSpacingSize.Small)
    );

    container.addTextDisplayComponents(
      new TextDisplayBuilder().setContent(message)
    );

    await channel.send({
      components: [container],
      flags: MessageFlags.IsComponentsV2,
    });

    await interaction.reply({
      content: `✅ Announcement sent to ${channel}`,
      ephemeral: true,
    });
  },
};

/*
: ! Aegis !
    + Discord: itsfizys
    + Portfolio: https://itsfiizys.com
    + Community: https://discord.gg/8wfT8SfB5Z  (AeroX Development )
    + for any queries reach out Community or DM me.
*/
dreamy iris
alpine rivet
#

Discord takes time to load slash commands

serene kettle
alpine rivet
serene kettle
#

Ok

dreamy iris
alpine rivet
#

But it simply means that how you coded a command

serene kettle
#

In that command what ever we write as description will comes as he said only change is that he needs a Separator between title and description and next to title user avatar as thumbnail which can be fetched by

interaction.user.displayAvatarURL()

serene kettle
#

🙂

dreamy iris
#

It worked but there is no user avatar and name executing the command

alpine rivet
#

Typo happens sometimes

#

And that doesnt effect the code

#

As I am not using any permission realted thing here

hazy lodge
#

Unless you use CustomClient

#

It won't work

hazy lodge
alpine rivet
alpine rivet
#

In the code above?

#

Or i'll just add them later

hazy lodge