-
Notifications
You must be signed in to change notification settings - Fork 26
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
Conversation
This depends on #73 |
- Build command output in the !live command instead of within the twitch api service.
lib/commands/implementations/live.js
Outdated
} | ||
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`; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
if (searchCalled % 2 === 1) { | ||
return Promise.resolve({ data: mockResponses.getActiveLiveBroadcastsVideoId }); | ||
} | ||
if (searchCalled % 2 === 0) { |
There was a problem hiding this comment.
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
I'm cool to merge this if you're satisfied with it. |
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. |
- If only 1 stream is just post the total viewship
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. |
👍 |
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:
betterderped way to mock YouTube responses so a test can be made for both when a stream is live and when there is no stream.