Skip to content

Commit

Permalink
stream photos link
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed May 18, 2024
1 parent f02ac85 commit 727896c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions handlers/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const config = require("../config")
const moment = require('moment')
require('moment-precise-range-plugin')
require('mathjs')
const randomLinks = require("../config/randomLinks.json");

const twitchUrl = 'https://www.twitch.tv/'

Expand Down Expand Up @@ -51,6 +52,10 @@ class Stream {
return unmaskedStart + masked + unmaskedEnd
}

async getScreenshots(target, bot) {
bot.say(target, `Fotos del stream ${config.externalUrl}/stream`)
}

async captureScreenshot(target, bot, notifierBot, displayName, roomId) {
const image = await BrowserService.getScreenshot().catch(() => { console.error('getScreenshot on captureScreenshot')})
if (image) {
Expand Down
4 changes: 4 additions & 0 deletions lib/inputParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class InputParser {
return text.toLowerCase().startsWith('!foto')
}

isAskingForShowScreenshots (text) {
return text.toLowerCase().startsWith('!fotos')
}

isAskingForF5 (text) {
return text.toLowerCase().startsWith('!f5')
}
Expand Down
4 changes: 4 additions & 0 deletions lib/messenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ class Messenger {
return handlers.tempsDeFlors.setActive(target, textSplit[1], this.bot, context['room-id'])
}

if (textSplit.length > 0 && inputParser.isAskingForShowScreenshots(textSplit[0])) {
return handlers.stream.getScreenshots(target, this.bot)
}

if (textSplit.length > 0 && inputParser.isAskingForTFScreenshot(textSplit[0]) && await handlers.tempsDeFlors.hasActiveSpot()) {
if (!this.cooldown.screenshotTF) {
this.cooldown.screenshotTF = true
Expand Down

0 comments on commit 727896c

Please sign in to comment.