sourceb.in Open in urlscan Pro
2a06:98c1:3120::3  Public Scan

Submitted URL: https://srcb.in/4P6LwwPyAe
Effective URL: https://sourceb.in/4P6LwwPyAe
Submission: On November 18 via manual from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

 * {SourceBin}

 * Upgrade Now - Go Pro
 * 
 * 
 * 


SNOW'S HELP COMMAND

Fixed Kaj's help command

Aug 30, 2023

131 views

I've spent 2 years learning DNS while building NSLookup.io. Now, I'm teaching
everything I know. ads via Carbon
 * JavaScript
 * helpCommand.js

   
   
 * Copy
 * Raw
   

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// All texts for embed, menu, command name and description, ... are in French
because I am, but translate it in your language :)

const { SlashCommandBuilder, StringSelectMenuBuilder, ActionRowBuilder,
ComponentType, EmbedBuilder } = require("discord.js");
let configClient = require('../../../Config/client.json') // I use my config
file only for embed color, but you can remove this line if you want

module.exports = {
data: new SlashCommandBuilder()
.setName('help')
.setDescription('โ€บ Renvoie la liste des commandes'),
async execute(interaction, client) {

// In this emojis object, make sure all values start in UpperCase, so not
'example' or 'EXAMPLE', but 'Example', else it not works
const emojis = {
Public: '๐ŸŒ',
Economie: '๐Ÿ’ฐ',
Niveaux: '๐Ÿ†™',
Test: '๐Ÿงช',
Bot: '๐Ÿค–'
}

const directories = [
...new Set(client.commands.map((cmd) => cmd.folder))
]

const categories = directories.map((dir) => {
const getCommands = client.commands.filter((cmd) => cmd.folder ===
dir).map((cmd) => {
return {
name: cmd.data.name,
description: cmd.data.description || 'Aucune description pour la commande ' +
cmd.data.name
}
})

return {
directory: dir,
commands: getCommands
}
})

const embed = new EmbedBuilder()
.setColor(configClient.colors.default)
.setDescription(`๐Ÿซง | Choisissez une catรฉgorie de commandes via le menu
ci-dessous`)
.setAuthor({name: interaction.user.username + ' | ' + interaction.user.id,
iconURL: interaction.user.displayAvatarURL({dynamic: true})})
.setTimestamp()

let array = []
let a = [...client.commands.values()].forEach(({folder}) => {
array.push(folder)
});
const array2 = Array.from(new Set(array))

const component = (state) => [
new ActionRowBuilder().addComponents(
new StringSelectMenuBuilder()
.setCustomId('help-menu')
.setPlaceholder('Choisissez une catรฉgorie...')
.setDisabled(state)
.addOptions(
array2.map((f) => {
return {
label: f,
value: f.toLowerCase(),
description: `Catรฉgorie des commandes : ${f}`,
emoji: emojis[f] ?? null
}
})
)
)
]

const initialMessage = await interaction.reply({
embeds: [embed], components: component(false)
})

const filter = (interaction) => interaction.user.id === interaction.member.id

const collector = interaction.channel.createMessageComponentCollector({
filter,
componentType: ComponentType.StringSelect
})

collector.on('collect', async(interaction) => {
const [directory] = interaction.values
const category = categories.find(
(x) => x.directory.toLowerCase() === directory
)

const categoryEmbed = new EmbedBuilder()
.setColor(configClient.colors.default)
.setDescription(`๐Ÿซง | Liste des commandes de la catรฉgorie ${directory}`)
.setAuthor({name: interaction.user.username + ' | ' + interaction.user.id,
iconURL: interaction.user.displayAvatarURL({dynamic: true})})
.setTimestamp()
.addFields(
category.commands.map(({name, description}) => {
return {
name: `\`/${name}\``,
value: `\`\`\`${description}\`\`\``,
inline: true
}
})
)

interaction.update({embeds: [categoryEmbed]})
})

collector.on('end', () => {
initialMessage.edit({components: component(true)})
})
}
}


ย 
ย 
ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”ื”
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Save



LANGUAGE SELECTOR

 * Terms
 * Privacy
 * Status

 * 
 * 
 * 

 * Go Pro
 * Billing