<commit_before># Description:
#   Gets the latest beers and their stats from the taphouse beerboard.
#   Also injects beer ratings from untapped
#
# Dependencies:
#   "tiny-rebel-web-scraper": "latest"
#
# Commands:
#   hubot what|which beers are on|available - gets the latest beer info from the board
#
# Author:
#   studioromeo
#
# Contributors:
#   tomseldon
#

tinyRebelWebScraper = require('tiny-rebel-web-scraper');

module.exports = (robot) ->

    excuses = [
        'No beers here. Go to the City Arms instead.',
        'Sorry, dunno what\'s on, we\'re all drunk.',
        'ZZZzzz...wha..no, drank it all, try somewhere else...zzzZZZzzzZZZzzz...'
    ]

    robot.respond /(what|which) beers are (on|available)/i, (msg) ->
        tinyRebelWebScraper.getAllDrinks('cardiff')
            .then((drinks) ->
                response = [
                    'Hey there!',
                    'The following drinks are available at Tiny Rebel (Cardiff):'
                ];

                drinks.forEach((drink) ->
                    response.push(
                      '(beer) ' + drink.name + ' [' + drink.brewery + '] - ' + drink.formattedPrice
                    )
                )

                msg.send response.join('\n')
            )
            .catch((error) ->
                console.error(error);
                msg.send msg.random excuses
            );
<commit_msg>[BUG] Account for half-pints when showing beer info<commit_after># Description:
#   Gets the latest beers and their stats from the taphouse beerboard.
#   Also injects beer ratings from untapped
#
# Dependencies:
#   "tiny-rebel-web-scraper": "latest"
#
# Commands:
#   hubot what|which beers are on|available - gets the latest beer info from the board
#
# Author:
#   studioromeo
#
# Contributors:
#   tomseldon
#

tinyRebelWebScraper = require('tiny-rebel-web-scraper');

module.exports = (robot) ->

    excuses = [
        'No beers here. Go to the City Arms instead.',
        'Sorry, dunno what\'s on, we\'re all drunk.',
        'ZZZzzz...wha..no, drank it all, try somewhere else...zzzZZZzzzZZZzzz...'
    ]

    robot.respond /(what|which) beers are (on|available)/i, (msg) ->
        tinyRebelWebScraper.getAllDrinks('cardiff')
            .then((drinks) ->
                response = [
                    'Hey there!',
                    'The following drinks are available at Tiny Rebel (Cardiff):'
                ];

                drinks.forEach((drink) ->
                    output = '(beer) ' + drink.name + ' [' + drink.brewery + '] - '

                    isHalfPint = drink.quantity == 'half'

                    output = output + '½ ' if isHalfPint
                    output = output + drink.formattedPrice

                    response.push(output)
                )

                msg.send response.join('\n')
            )
            .catch((error) ->
                console.error(error);
                msg.send msg.random excuses
            );

{'fraction_non_alphanumeric': 0.1210596914822267, 'fraction_numerical': 0.0, 'mean_word_length': 1.706896551724138, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4470120', 'n_tokens_mistral': 922, 'n_tokens_neox': 868, 'n_words': 220}