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

Commit

Permalink
3.11.1: removed invites, truncated others
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjornskjald committed Sep 15, 2018
2 parents f60552f + 939eba8 commit e16e444
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [3.11.1] - 2018-09-15
### Added
- Truncating people in plans

### Removed
- "Invited" people in plans

## [3.11.0] - 2018-09-15
### Added
- Timestamps in the logs/console
Expand Down
11 changes: 5 additions & 6 deletions lib/messenger/handlePlan.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ module.exports = async message => {
// handle whitelist
if (!filter(await getChannelName(thread), message.threadID)) return

const going = (await Promise.all(message.event_data.guest_state_list.filter(el => el.guest_list_state === 'GOING').map(el => getSender(el.node.id))))
const invited = (await Promise.all(message.event_data.guest_state_list.filter(el => el.guest_list_state === 'INVITED').map(el => getSender(el.node.id))))
const declined = (await Promise.all(message.event_data.guest_state_list.filter(el => el.guest_list_state === 'DECLINED').map(el => getSender(el.node.id))))
const people = message.event_data.guest_state_list
const going = (await Promise.all(people.filter(el => el.guest_list_state === 'GOING').map(el => getSender(el.node.id)))).map(el => el.name)
const declined = (await Promise.all(people.filter(el => el.guest_list_state === 'DECLINED').map(el => getSender(el.node.id)))).map(el => el.name)

const { event_location_name: location, latitude, longitude } = message.event_data

Expand All @@ -31,9 +31,8 @@ Time: ${new Date(message.event_data.event_time * 1000).toLocaleString('en-GB', {
})}
Location: ${location ? latitude !== '0' ? `[${location}](https://google.com/maps/place/${latitude},${longitude})` : location : '(none)'}
Invited (${invited.length}): ${invited.map(el => el.name).join(', ')}
Going (${going.length}): ${going.map(el => el.name).join(', ')}
Can't go (${declined.length}): ${declined.map(el => el.name).join(', ')}
Going (${going.length}): ${going.length > 10 ? going.slice(0, 10).join(', ') + `and ${going.length - 10} more...` : going.join(', ')}
Can't go (${declined.length}): ${declined.length > 10 ? declined.slice(0, 10).join(', ') + `and ${declined.length - 10} more...` : declined.join(', ')}
`

const channels = await connections.getChannels(message.threadID, thread.name)
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "miscord",
"version": "3.11.0",
"version": "3.11.1",
"description": "Facebook Messenger to Discord bridge",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e16e444

Please sign in to comment.