GithubHelp home page GithubHelp logo

uo1428 / suggestion-bot---uo-1428 Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 123 KB

Best Suggestion And Poll System Bot For Discord With Slash Command, Modals, Buttons, Menu..............

License: GNU General Public License v3.0

JavaScript 99.50% Nix 0.50%

suggestion-bot---uo-1428's Introduction

suggestion-bot---uo-1428's People

Contributors

grdayush avatar uo1428 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

suggestion-bot---uo-1428's Issues

Suggestion command with buttons

Hi i am trying to do a suggestion command with djs 14. And so far i have made like the format of a command and stuff. But i keep getting this error is there any way you could help?

const { EmbedBuilder, Client, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, ApplicationCommandOptionType } = require("discord.js");
const SuggestDB = require("../../Structures/Schemas/SuggestDB");

module.exports = {
    name: "suggest",
    description: "Suggest something",
    type: 3,
    options: [
        {
            name: "type",
            description: "Whats the type of your suggestion.",
            required: true,
            type: 3
        }
    ],
    name: "actions",
    description: "Suggest something",
    type: 3,
    options: [
        {
            name: "suggest",
            description: "Whats the type of your suggestion.",
            required: true,
            choices: [
                { name: "Command", value: "command" },
                { name: "Event", value: "event" },
                { name: "System", value: "System" },
                { name: "Other", value: "other" }
            ]
        },
        {
            name: "suggestion",
            description: "Name your suggestion.",
            required: true,
            type: 3,
        },
        {
            name: "description",
            description: "Describe your suggestion.",
            required: true,
            type: 3,
        },
    ],

    async execute(interaction, client) {

        const { guild, options, member } = interaction
        client.on(Events.InteractionCreate, async interaction => {
	if (!interaction.isChatInputCommand()) return;

	if (interaction.commandName === 'button') {

        const suggestion = options.getString("suggestion")
        const Description = options.getString("description")
        const Type = options.getString("type")

        const embed = new EmbedBuilder()
            .setColor("Navy")
            .setAuthor({ name: `${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL({ dynamic: true })}` })
            .addFields(
                { name: "🟠 | New Suggestion", value: `${Suggestion} ` + `:\n \`${description}\``, inline: false },
                { name: "Type", value: `${type}`, inline: true },
                { name: "Status", value: "Pending", inline: true }
            )
            .setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
            .setTimestamp();
        
    const row = new ActionRowBuilder()
			.addComponents(
				new ButtonBuilder()
					.setCustomId('suggest-accept')
					.setLabel('accept')
					.setStyle(ButtonStyle.Success),
			);

		await interaction.reply({ content: 'I think you should,', components: [row] });
        	}
});

        try {
            const msg = await client.channels.cache
                .get("990914879563124758")
                .send({ embeds: [embed], components: [row] });
            await SuggestDB.create({
                Guild: guild.id,
                Message: msg.id,
                Details: [
                    {
                        MemberID: interaction.user.id,
                        Type: ApplicationCommandOptionType.String,
                        Suggestion: Suggestion,
                    },
                ],
            });
        } catch (error) {
            console.log(error);
        }
    }
}

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.