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

View file

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

View file

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