Browse Source

3.2.0-b2

Fix some issues with 3.2 upgrades
shorten
benji7425 3 years ago
parent
commit
446df2f8a7
  1. 2
      CHANGELOG.md
  2. 3
      app/legacy-upgrader.js
  3. 14
      app/models/feed-data.js
  4. 3
      discord-bot-core/HandleGuildMessage.js
  5. 2
      package.json

2
CHANGELOG.md

@ -1,4 +1,6 @@
# Changelog
### Fixed
- Fixed upgrader script not including channel ID in new database
## v3.2.0-b1
### Updated

3
app/legacy-upgrader.js

@ -16,6 +16,7 @@ module.exports = function () {
feedID: feed.id,
url: feed.url,
roleID: feed.roleID,
channelID: feed.channelID,
cachedLinks: feed.cachedLinks,
maxCacheSize: feed.maxCacheSize
}));
@ -24,5 +25,5 @@ module.exports = function () {
guildData.save();
}
FileSystem.unlinkSync("./guilds.json");
FileSystem.rename("./guilds.json", "./guilds.json.backup");
};

14
app/models/feed-data.js

@ -64,21 +64,25 @@ module.exports = class FeedData extends Camo.EmbeddedDocument {
}
_doFetchRSS(guild) {
FeedReadPromise(this.url + "asdf")
const that = this;
FeedReadPromise(this.url)
.then(articles => {
if (articles.length > 0 && articles[0].link) {
const latest = normaliseUrl(articles[0].link);
if (!this.cachedLinks.includes(latest)) {
const channel = guild.channels.get(this.channelID),
role = guild.roles.get(this.roleID);
if (!that.cachedLinks.includes(latest)) {
that.cache(latest);
const channel = guild.channels.get(that.channelID),
role = guild.roles.get(that.roleID);
channel.send((role || "") + formatPost(articles[0]))
.catch(err => DiscordUtil.dateDebugError(`Error posting in ${channel.id}: ${err.message || err}`));
}
}
})
.catch(err => DiscordUtil.dateDebugError(`Error reading feed ${this.url}`, err));
.catch(err =>
DiscordUtil.dateDebugError(`Error reading feed ${that.url}`, err));
}
};

3
discord-bot-core/HandleGuildMessage.js

@ -17,6 +17,9 @@ function handleGuildMessage(client, message, commands) {
function handleGuildCommand(client, message, commands, guildData) {
const { botName, isMemberAdmin, params, command } = parseDetails(message, commands);
if (!command)
return;
if (params.length < command.expectedParamCount)
message.reply(`Incorrect syntax!\n**Expected:** *${botName} ${command.syntax}*\n**Need help?** *${botName} help*`);

2
package.json

@ -1,5 +1,5 @@
{
"version": "3.2.0-b1",
"version": "3.2.0-b2",
"main": "app/index.js",
"scripts": {
"postinstall": "cd ./discord-bot-core && npm install",

Loading…
Cancel
Save