Giter Club home page Giter Club logo

tb's Introduction

Tb, the Twitch Chat "Bouncer"

It powers Tc, the Twitch chat client ๐Ÿ˜Š

Demo

backlog.gettc.xyz/v1/itshafu

API

/:channel - Where channel is a twitch username.

Query parameters:
after - Get messages after this timestamp in milliseconds. Default: one hour ago
before: Get messages before this timestamp in milliseconds. Default: now
limit: Only grab up to this many messages, removing older ones first. Default: 30

Requirements:

  • Persistent disk space
  • Node.js
  • Port 6255 available

Message format

{user, message, at} - Where at is a timestamp in milliseconds.

// A request will produce an array of these
{
  user: {
    badges: "moderator/1",
    color: "#FF0000",
    display-name: "YuukiHatsu",
    emotes: {
      354: [
        "21-25"
      ]
    },
    mod: true,
    room-id: "30777889",
    subscriber: false,
    turbo: false,
    user-id: "51320169",
    user-type: "mod",
    emotes-raw: "354:21-25",
    username: "yuukihatsu",
    message-type: "chat"
  },
  message: "no, imma watch strim 4Head",
  at: 1462385825967
},

Setup and usage

It's currently not very customizable, sorry.

  • Clone repo
  • Cd into it
  • Run npm i
  • Run npm start

Tb now handles requests at http://localhost:6255/v1. Set up your reverse proxy however you see fit.

ISC License

Copyright (c) 2016 by Andrea Stella [email protected]

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

tb's People

Contributors

bap14 avatar mccxiv avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tb's Issues

Incorrect use of async

Looking through the source, I've seen a lot of incorrect uses of async.
Async should be used when you're using await inside the function or when you return a Promise (if you're not doing that anyway).
Especially with Babel, a lot of excess cruft is generated when not keeping to that basic rule, slowing things down.
Async doesn't mean a function is asynchronous. Javascript is synchronous by definition, relying on callbacks. Await only ensures waiting for a promise, like Promise.apply(). Await is only really valid when doing that.

I tested the code by removing useless async definitions, code was faster because of it, without other side effects.

Batch writes together

At peak chat spam, we're writing 40 times a second to the db. This sometimes chokes the disk, especially on the crappy VPS I'm using.

Let's batch messages in memory, and write them all at once instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.