Skip to content

Commit b3e08d1

Browse files
committed
bugfix for guild not being found
1 parent 2504bb6 commit b3e08d1

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

index.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ class cDClient extends Client {
184184
for (let command of privateCommands) {
185185
for (gid of command.guildIds) {
186186
if (
187+
!clientGuilds ||
187188
(clientGuilds &&
188-
clientGuilds.find(
189-
(guild) => guild.id === gid
190-
)) ||
191-
!clientGuilds
189+
clientGuilds.find((guild) => guild.id === gid))
192190
) {
193191
try {
194192
data = await rest.post(
@@ -199,17 +197,17 @@ class cDClient extends Client {
199197
);
200198
if (logOptions.updated)
201199
console.log(
202-
`✔️ Updated command '${command.data.name}' in guild ${gid}.`
200+
`✔️ Updated command '${command.data.name}' in guild '${gid}'.`
203201
);
204202
updatedPrivates++;
205203
} catch (err) {
206204
console.error(
207-
`❌ Couldn't update '${command.data.name}'; Maybe the guild ${gid} wasn't found in the current guilds.`
205+
`❌ Couldn't update '${command.data.name}'; Maybe the guild '${gid}' wasn't found in the current guilds.`
208206
);
209207
}
210208
} else {
211-
console.error(
212-
` Couldn't update '${command.data.name}' since guild ${gid} wasn't found in the current guilds.`
209+
console.warn(
210+
`⚠️ Couldn't update '${command.data.name}' since guild '${gid}' wasn't found in the current guilds.`
213211
);
214212
}
215213
}
@@ -254,7 +252,7 @@ class cDClient extends Client {
254252

255253
if (!theCommand) {
256254
console.error(
257-
`Command '${command}' not found in guild '${guildId}'`
255+
`Command '${command}' not found in guild '${guildId}'`
258256
);
259257
return;
260258
}
@@ -263,13 +261,13 @@ class cDClient extends Client {
263261
}
264262
} catch (err) {
265263
console.error(
266-
`Error while deleting a command in guild '${guildId}'`,
264+
`Error while deleting a command in guild '${guildId}'`,
267265
err
268266
);
269267
}
270268
return;
271269
}
272-
};
270+
}
273271

274272
module.exports = cDClient;
275273

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"name": "djs-command-deployer",
3-
"version": "0.9.2",
3+
"version": "0.9.3",
44
"description": "",
55
"main": "./index.js",
6-
"scripts": {
7-
"test": "node ./tests/test-index.js"
8-
},
6+
"scripts": { },
97
"keywords": [
108
"discord",
119
"discord.js",

0 commit comments

Comments
 (0)