remove userId from config

This commit is contained in:
Jonny_Bro (Nikita) 2024-02-14 21:16:13 +05:00
parent 1128269023
commit 8766a10469
No known key found for this signature in database
GPG key ID: 391C19BE62D36B33
3 changed files with 29 additions and 22 deletions

View file

@ -137,8 +137,8 @@ class JaBaClient extends Client {
}
try {
if (this.config.production) await rest.put(Routes.applicationCommands(this.config.userId), { body: commands });
else await rest.put(Routes.applicationGuildCommands(this.config.userId, this.config.support.id), { body: commands });
if (this.config.production) await rest.put(Routes.applicationCommands(this.user.id), { body: commands });
else await rest.put(Routes.applicationGuildCommands(this.user.id, this.config.support.id), { body: commands });
this.logger.log("Successfully registered application commands.");
} catch (err) {
@ -177,17 +177,23 @@ class JaBaClient extends Client {
.setThumbnail(data.thumbnail || null)
.addFields(data.fields || [])
.setImage(data.image || null)
.setURL(data.url || null)
.setColor(data.color || this.config.embed.color)
.setFooter(data.footer || this.config.embed.footer);
.setURL(data.url || null);
if (data.color) embed.setColor(data.color);
else if (data.color === null) embed.setColor(null);
else embed.setColor(this.config.embed.color);
if (data.footer) embed.setFooter(data.footer);
else if (data.footer === null) embed.setFooter(null);
else embed.setFooter(this.config.embed.footer);
if (data.timestamp) embed.setTimestamp(data.timestamp);
else if (data.timestamp === null) embed.setTimestamp(null);
else embed.setTimestamp();
if (typeof data.author === "string") embed.setAuthor({ name: data.author, iconURL: this.user.avatarURL() });
if (!data.author || data.author === null) embed.setAuthor(null);
else if (typeof data.author === "string") embed.setAuthor({ name: data.author, iconURL: this.user.avatarURL() });
else if (typeof data.author === "object" && (data.author.iconURL !== null || data.author.iconURL !== undefined)) embed.setAuthor({ name: data.author.name, iconURL: this.user.avatarURL() });
else if (!data.author || data.author === null) embed.setAuthor(null);
else embed.setAuthor(data.author);
return embed;

View file

@ -1,38 +1,39 @@
module.exports = {
/* The token of your Discord Bot */
token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
/* ID of Bot's user */
userId: "123456789098765432",
/* The URL of the MongoDB database */
mongoDB: "mongodb://127.0.0.1:27017/discordbot",
/* Set to true for production */
/* If set to false, commands only will be registered on the support.id server */
production: true,
/* For the support server */
/* Support server */
support: {
id: "123456789098765432", // The ID of the support server
logs: "123456789098765432", // And the ID of the logs channel of your server (when bot joins or leaves a guild)
invite: "https://discord.gg/discord", // Invite link to your support server
logs: "123456789098765432", // The channel's ID for logs on the support server (when bot joins or leaves a guild)
invite: "https://discord.gg/discord", // Invite link to the support server
},
/* Dashboard configuration */
dashboard: {
enabled: false, // Whether the dashboard is enabled or not
maintanceKey: "letmein", // Your maintance key
maintanceKey: "letmein", // Maintance key
port: 80, // Dashboard port
domain: "http://localhost", // The base URL of the dashboard without / at the end
secret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", // Your Bot's Client Secret
logs: "123456789098765432", // The channel ID for logs
},
mongoDB: "mongodb://127.0.0.1:27017/discordbot", // The URL of the MongoDB database
/* For the embeds */
/* Embeds defaults */
embed: {
color: "#00FF00", // The default color for the embeds
color: "#00FF00", // Color
footer: {
text: "My Discord Bot | v" + require("./package.json").version,
}, // And the default footer for the embeds
text: "My Discord Bot | v" + require("./package.json").version, // Footer text
},
},
/* Bot's owner informations */
owner: {
id: "123456789098765432", // The ID of the bot's owner
},
/* The API keys that are required for certain commands */
apiKeys: {},
/* Add your own API keys here */
apiKeys: {
},
};

View file

@ -45,7 +45,7 @@ module.exports.load = async client => {
const Dashboard = new DBD.Dashboard({
port: client.config.dashboard.port,
client: {
id: client.config.userId,
id: client.user.id,
secret: client.config.dashboard.secret,
},
cookiesSecret: client.config.dashboard.secret,
@ -55,7 +55,7 @@ module.exports.load = async client => {
ownerIDs: [client.config.owner.id],
requiredPermissions: PermissionsBitField.Flags.ViewChannel,
invite: {
clientId: client.config.userId,
clientId: client.user.id,
scopes: ["bot", "applications.commands"],
permissions: "8",
redirectUri: `${client.config.dashboard.domain}`,