#javascript #discord.js
Вопрос:
в моей команде справки есть префикс not, но я хочу поместить его в префикс сервера asper, например, если кто-то изменит префикс моего бота на своем сервере по команде справки, он должен быть префиксом для их сервера, мне нужна помощь в этом, если это возможно
const { MessageEmbed } = require("discord.js");
const { readdirSync } = require("fs");
const { stripIndents } = require("common-tags");
const { embedcolor } = require("../../configs/config.json");
const { default_prefix } = require("../../configs/config.json")
const config = require('../../configs/config.json');
module.exports = {
config: {
name: "help",
aliases: ["h"],
usage: "[command name] (optional)",
category: "info",
description: "",
accessableby: "everyone"
},
run: async (client, message, args) => {
const embed = new MessageEmbed()
.setColor(embedcolor)
.setAuthor(`${message.guild.me.displayName}`, message.guild.iconURL())
.setThumbnail(client.user.displayAvatarURL())
if (!args[0]) {
embed.setDescription(`Soune's Prefix Is `${default_prefix}``)
embed.setFooter(`${message.guild.me.displayName} | Total Commands - ${client.commands.size - 1} Loaded`, client.user.displayAvatarURL());
embed.addField(`util [7] - `, '`dm`, `fullembed`, `help`, `poll`, `say`, `snipe`, `prefix`')
embed.addField(`Fun [5] - `, '`cute`,`cat`, `dog`, `meme`, `ping`,')
embed.addField(`Mod [13] - `, '`ban`, `clear`, `give-roles`, `kick`, `mute`, `nuke`, `slowmode`, `unmute`, `warn`, `lock`, `remove-roles`, `unban`, `unlock`')
embed.addField(`info [6] - `, '`bot-info`, `server-info`, `total-bans`, `user-info`, `profile`, `uptime`')
embed.addField(`giveaway [4] - `, '`giveaway`, `reroll`, `edit`, `end`')
embed.setFooter(`Antra My Owner`)
embed.setTimestamp()
return message.channel.send(embed)
} else {
let command = client.commands.get(client.aliases.get(args[0].toLowerCase()) || args[0].toLowerCase())
if (!command) return message.channel.send(embed.setTitle("**Invalid Command!**").setDescription(`**Do `${default_prefix}help` For the List Of the Commands!**`))
command = command.config
embed.setDescription(stripIndents`**Prefix Is `${default_prefix}`**n
** Command -** ${command.name.slice(0, 1).toUpperCase() command.name.slice(1)}n
** Description -** ${command.description || "No Description provided."}n
** Usage -** ${command.usage ? ``${default_prefix}${command.name} ${command.usage}`` : "No Usage"}n
** Needed Permissions -** ${command.accessableby || "everyone can use this command!"}n
** Aliases -** ${command.aliases ? command.aliases.join(", ") : "None."}`)
embed.setFooter(message.guild.name, message.guild.iconURL())
return message.channel.send(embed)
}
}
};
Комментарии:
1. Вам нужно будет создать базу данных для отслеживания префиксов
2. Привет, добро пожаловать в StackOverflow. Я рекомендую использовать NeDB для вашей базы данных. Вот полезный урок. счастливого кодирования!
3. Thx так много, если я не смогу понять, я увижу учебник по yt и узнаю, как отслеживать префиксы
4. сложно ли с mongodb?