Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Fixed crash on failed attachment URL request (also, a typo) #395

Merged
merged 3 commits into from Jan 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog

## [4.6.1] - 2019-01-04
### Fixed
- Crash on failed attachment URL request
- A typo in help command

## [4.6.0] - 2019-01-04
### Added
- `broadcast` command
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/help.js
Expand Up @@ -11,7 +11,7 @@ module.exports = new Command(_ => `Commands available:
- \`link\` - adds an endpoint to an existing connection
- \`unlink\` - removes an endpoint from an existing connection
- \`readonly\` - toggles read-only status
- \`showConfig\` - shows the entire config\
- \`showConfig\` - shows the entire config
- \`broadcast\` - broadcast a message to every registered connection
- \`help\` - shows this message
- \`quit\` - exits Miscord`)
10 changes: 8 additions & 2 deletions lib/createMessage/getAttachmentURL.js
Expand Up @@ -31,8 +31,14 @@ module.exports = async (message, attach) => {
url = await messenger.client.getAttachmentURL(message.id, attach.id)
} catch (err) {
log.warn(err)
log.warn('Failed to get the URL, retrying...')
url = await messenger.client.getAttachmentURL(message.id, attach.id)
log.warn('Failed to get the URL, retrying in 5 seconds...')
await new Promise(resolve => setTimeout(resolve, 5 * 1000))
try {
url = await messenger.client.getAttachmentURL(message.id, attach.id)
} catch (err) {
log.fatal(`Could not get an URL for attachment ${attach.id}`)
return
}
}
if (!url) log.fatal(`Could not get an URL for attachment ${attach.id}`)
return url
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "miscord",
"version": "4.6.0",
"version": "4.6.1",
"description": "Facebook Messenger to Discord bridge",
"main": "index.js",
"scripts": {
Expand Down