Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YouTube viewers to !live command #70

Merged
merged 6 commits into from
Oct 16, 2020
Merged

Conversation

dotted
Copy link
Contributor

@dotted dotted commented Oct 11, 2020

Made this for the memes, so if you end up not pulling this I wont be mad Abathur.

Only tested with npm test using Node 14, because Node 8 is simple too boomer even for me.

Tasks:

  • Add methods to get YouTube concurrent viewers in YouTube service.
  • Add YouTube concurrent view count to !live command.
  • Figure out a better derped way to mock YouTube responses so a test can be made for both when a stream is live and when there is no stream.

@dotted dotted marked this pull request as ready for review October 12, 2020 01:35
@dotted dotted marked this pull request as draft October 12, 2020 01:36
@dotted dotted marked this pull request as ready for review October 12, 2020 03:42
@dotted
Copy link
Contributor Author

dotted commented Oct 12, 2020

This depends on #73

@dotted dotted marked this pull request as draft October 12, 2020 21:31
}
const now = moment();
const formattedDuration = formatDuration(moment.duration(now.diff(twitchStatus.started)));
const output = `Viewers: ${totalViewers}, TTV: ${twitchViewers}, YT: ${youtubeViewers}. Stream live as of ${formattedDuration} ago`;
Copy link
Contributor Author

@dotted dotted Oct 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestions to present this better are welcome

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine.

@dotted dotted marked this pull request as ready for review October 13, 2020 02:50
@dotted dotted changed the title Add ability to get concurrent viewer count In YouTube service Add YouTube viewers to !live command Oct 13, 2020
if (searchCalled % 2 === 1) {
return Promise.resolve({ data: mockResponses.getActiveLiveBroadcastsVideoId });
}
if (searchCalled % 2 === 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to something that isn't extremely fragile, but it works for now

@shadedred
Copy link
Collaborator

I'm cool to merge this if you're satisfied with it.

@dotted
Copy link
Contributor Author

dotted commented Oct 16, 2020

Seems I stopped short of actually handling an offline stream, now it just spits out 0 viewers instead of previous behavior. Let me just get that fixed first.

@dotted dotted marked this pull request as draft October 16, 2020 16:45
- If only 1 stream is just post the total viewship
@dotted
Copy link
Contributor Author

dotted commented Oct 16, 2020

It looks GTG now, haven't tested the last commit with either a live youtube stream or both live twitch and youtube streams, but offline stream and an active twitch stream gives proper output.

@dotted dotted marked this pull request as ready for review October 16, 2020 18:41
@dotted dotted requested a review from shadedred October 16, 2020 18:41
@shadedred shadedred merged commit 4c8a679 into destinygg:master Oct 16, 2020
@shadedred
Copy link
Collaborator

👍

@dotted dotted deleted the youtube-arc branch October 16, 2020 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants