Skip to main content

suggest

An Beautiful suggestion system with buttons ;D | Requires: manageSuggest()

This function requires connect() which connects to the mongo database !

Implementation

simplydjs.suggest(interaction, { 
channelId: '01234567890123' // channelId (required)

// options (optional)
})

Output

suggestion

Types

simplydjs.suggestSystem(
msgOrint: ExtendedMessage | ExtendedCommandInteraction,
options: suggestOption
): Promise<SuggestResolve>
info

This is just 50% of the code for Suggest System !. You also need manageSuggest() to handle all button clicks. This makes it 100% !

Options

suggestOption

ParameterTypeRequiredDefaultDescription
strictbooleanfalseEnables strict mode in suggest
channelIdstring-Channel Id to send the suggestion in your server
embedCustomizableEmbeddefault embedPass a CustomizableEmbed Object to customize the embed
buttonsSuggestButtonsdefault buttonsPass a suggestButtons Object to customize the button
suggestionstringnoneThe suggestion to post in the server
progressProgressdefaultPass a Progress Object to customize the suggestion vote percentage bar
export type suggestOption = {
embed?: CustomizableEmbed;
channelId?: string | TextChannel;
suggestion?: string;
buttons?: SuggestButtons;
progress?: Progress;
strict: boolean;
};

SuggestButtons

ParameterTypeDescription
votedInfoCustomizableButtonA CustomizableButton Object to customize the who voted button
upvoteCustomizableButtonA CustomizableButton Object to customize the upvote button
downvoteCustomizableButtonA CustomizableButton Object to customize the downvote button
export interface SuggestButtons {
votedInfo?: CustomizableButton;
upvote?: CustomizableButton;
downvote?: CustomizableButton;
}

Progress

ParameterTypeDefaultDescription
upstring'🟩'The emoji to show instead of green box at progress
downstring'🟥'The emoji to show instead of red box at progress
blankstring'⬛'The emoji to show instead of black box at progress
export interface Progress {
up: string;
down: string;
blank: string;
}

Resolve

SuggestResolve

{
suggestion: string; // the suggestion provided
channel: TextChannel; // the channel to send the suggestion
user: GuildMember; // the user who suggested
}

Example

  • Default settings

suggest.js
const simplydjs = require('simply-djs')

simplydjs.suggest(interaction, {
channelId: "01234567890123",
})
  • Customized with options

suggest.js
const { ButtonStyle } = require('discord.js')
const simplydjs = require('simply-djs')

simplydjs.suggest(interaction, {
channelId: "01234567890123", // required
strict: true,
embed: {
title: "A new suggestion",
color: simplydjs.toRgb("#406dbc")
},
buttons: {
upvote: { style: ButtonStyle.Primary },
downvote: { style: ButtonStyle.Danger },
whoVoted: { style: ButtonStyle.Success }
},
progress: {
up: '🟩',
down: '🟥',
blank: '⬛'
}
})