Skip to content

Commit 6417771

Browse files
committed
fixed remaining logUpdates param
1 parent a386d6e commit 6417771

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

index.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ module.exports = class cDClient extends Client {
2626
* @param {string} token The bot's token (if the client isn't logged in yet)
2727
* @param {DEFAULT_OPTS} logOptions Whether to log what command was ignored, created, updated or deleted
2828
*/
29-
async deployCommands(
30-
folderPath,
31-
token = null,
32-
logOptions = DEFAULT_OPTS
33-
) {
29+
async deployCommands(folderPath, token = null, logOptions = DEFAULT_OPTS) {
3430
if (!(this.token || token || this.isReady())) {
3531
console.error(
3632
"Either token must be given or the client must be logged in!"
@@ -135,32 +131,32 @@ module.exports = class cDClient extends Client {
135131
}
136132
}
137133

138-
if (logUpdates)
134+
if (logOptions.status)
139135
console.log(
140136
`🔁 Deleting ${toDelete.length} global commands...`
141137
);
142138
for (let cmd of toDelete) {
143139
await rest.delete(
144140
`/applications/${clientId}/commands/${cmd.id}`
145141
);
146-
if (logUpdates) console.log(`✔️ Deleted '${cmd.name}'`);
142+
if (logOptions.deleted) console.log(`✔️ Deleted '${cmd.name}'`);
147143
}
148144

149-
if (logUpdates)
145+
if (logOptions.status)
150146
console.log(`🔁 Creating ${_new.length} global commands...`);
151147
for (let cmd of _new) {
152148
data = await rest.post(`/applications/${clientId}/commands`, {
153149
body: cmd,
154150
});
155-
if (logUpdates) console.log(`✔️ Created '${cmd.name}'`);
151+
if (logOptions.created) console.log(`✔️ Created '${cmd.name}'`);
156152
}
157153

158-
if (logUpdates)
154+
if (logOptions.status)
159155
console.log(`🔁 Updating ${updated.length} global commands...`);
160156
data = await rest.put(`/applications/${clientId}/commands`, {
161157
body: updated,
162158
});
163-
if (logUpdates)
159+
if (logOptions.updated)
164160
updated.forEach((cmd) =>
165161
console.log(`✔️ Updated '${cmd.name}' global commands.`)
166162
);
@@ -177,7 +173,8 @@ module.exports = class cDClient extends Client {
177173
}
178174
clientGuilds = this.guilds.cache;
179175

180-
if (logUpdates) console.log(`🔁 Updating guild commands...`);
176+
if (logOptions.status)
177+
console.log(`🔁 Updating guild commands...`);
181178
let updatedPrivates = 0;
182179
for (let command of privateCommands) {
183180
for (gid of command.guildIds) {
@@ -189,20 +186,19 @@ module.exports = class cDClient extends Client {
189186
body: command.data,
190187
}
191188
);
192-
if (logUpdates)
189+
if (logOptions.updated)
193190
console.log(
194191
`✔️ Updated command '${command.data.name}' in guild ${gid}.`
195192
);
196193
updatedPrivates++;
197194
} else {
198-
if (logUpdates)
199-
console.log(
200-
`❌ Couldn't update '${command.data.name}' since guild ${gid} wasn't found in the current guilds.`
201-
);
195+
console.error(
196+
`❌ Couldn't update '${command.data.name}' since guild ${gid} wasn't found in the current guilds.`
197+
);
202198
}
203199
}
204200
}
205-
if (logOptions.status)
201+
if (logOptions.updated)
206202
console.log(
207203
`✅ Updated ${updatedPrivates} guild commands.`
208204
);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "djs-command-deployer",
3-
"version": "0.6.2",
3+
"version": "0.7.0",
44
"description": "",
55
"main": "./index.js",
6-
"scripts": {},
6+
"scripts": { },
77
"keywords": [
88
"discord",
99
"discord.js",

0 commit comments

Comments
 (0)