diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f3d982..5081aae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). --- +## [**1.3.2**] - 2021-06-20 + +### Fixed + +* Set channel now doesn't depend on the guild cache. + ## [**1.3.1**] - 2021-06-20 ### Added diff --git a/package.json b/package.json index e05576f..103aa6f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "daily-image-discord-bot", "displayName": "Daily Image Bot", - "version": "1.3.1", + "version": "1.3.2", "description": "A discord bot that sends a daily image from a Google photos album, right to your selected discord channel", "main": "out/index.js", "scripts": { diff --git a/src/commands/commands-controller.ts b/src/commands/commands-controller.ts index 6539a71..0bb5dfb 100644 --- a/src/commands/commands-controller.ts +++ b/src/commands/commands-controller.ts @@ -37,6 +37,7 @@ export default class CommandsController { switch (CMD_NAME.toLocaleLowerCase()) { case "albumlink": + case "albumLink": await this.setAlbumLink(message, args); break; case "channel": @@ -49,6 +50,7 @@ export default class CommandsController { helpCommand(message); break; case "sendmsg": + case "msgsend": await this.setSendMsg(message, args); break; case "info": @@ -91,7 +93,7 @@ export default class CommandsController { */ private async setChannel(message: Message, channelToBeSet: string[]): Promise { if (!checkIfUserIsAdmin(message)) return; - const channelId = await this.client.channels.cache.find( + const channelId = message.guild.channels.cache.find( (channel: { name: string; }) => channel.name === channelToBeSet[0]); if (channelId && channelId.id) { await this.databaseController.setChannel(message.guild.id, channelId.id); @@ -147,9 +149,8 @@ export default class CommandsController { } } else { // CRON started the job. and we don't have the message available let dimgs = await this.databaseController.findAll(); - for (const dimg of dimgs) { // iterate over every document and send the photos to every respective server - await this.fetchAndSendPhoto(dimg); - } + // iterate over every document and send the photos to every respective server + for (const dimg of dimgs) await this.fetchAndSendPhoto(dimg); } }