GithubHelp home page GithubHelp logo

twubot's Introduction

twitch-hubot

Build Status

twitch-hubot is a chat bot built on the Hubot framework. It was initially generated by generator-hubot, and configured to be deployed on Heroku to get you up and running as quick as possible.

This README is intended to help get you started. Definitely update and improve to talk about your own instance, how to use and deploy, what functionality he has, etc!

Local execution

Please refer to the doc on running locally

Scripting

An example script is included at scripts/example.coffee, so check it out to get started, along with the Scripting Guide.

For many common tasks, there's a good chance someone has already one to do just the thing.

external-scripts

Hubot is able to load scripts from third-party npm package. Check the package's documentation, but in general it is:

  1. Add the packages as dependencies into your package.json
  2. npm install to make sure those packages are installed
  3. Add the package name to external-scripts.json as a double quoted string

You can review external-scripts.json to see what is included by default.

Persistence

Twubot has a special access interface to the brain to cut down on some of the edge cases encountered in its development

Please refer to the example in scripts/example.coffee for how to use the brain properly. Failure to follow this pattern will result in loss of data.

Adapters

Twubot is designed to run on Twitch by default. It can also connect to YouTube Live and Discord to provide the same functionality across multiple platforms.

There are plans to add more in the near future.

If you wish to run it on a new platform, you are welcome to find/write a compatible adapter. Run npm install --save <adpater package name> to install it and then run hubot with the adapter.

% bin/hubot -a <adapter>

Where <adapter> is the name of your adapter without a hubot- prefix.

Deployment

Please refer to the docs on deployment

twubot's People

Contributors

mattwwarren avatar

Stargazers

 avatar

Watchers

 avatar  avatar

twubot's Issues

Implement voting

!vote thing - default yes/no answers
!vote thing choice1 choice2 ... choicen

How do you differentiate between thing and choice1?

Reminder plugin

Set via a list of items in the brain, remind the chat on a rotation to do things like follow on Twitch/Twitter, join Discord or sub to YouTube.

Consider !live command

Could be a way to work around Twitch API integration for the time being. !live triggers a "we're going live" chat message, encouraging users to say hello for credits. Message can be configured with a file to HUBOT_TWITCH_LIVE

Update README

Take all the auto-generated junk out of the existing and move it into INSTALL. Write better docs about how to actually run the project and how to use my services to make it easier.

Finish viewership script

Record user follow times
Populate previous followers in robot brain
Detect live times (and save total live time in ms; grab based on "connected" event)
Handle viewers' total view time (process on user join and part)

Implement an inventory system

From reddit:

I am streaming Pokemon and me and my mods have come up with an Elite 4 challenge. The only reason why it's not working at this point in time is because we wanted players to have the ability to buy revives for their team. So basically you type in a command which then sends a message to my bot telling it to take earned credits from their total balance. In exchange they for example get 1 revive which they can spend by using another command.

So from this, mod commands to manage the "shop" inventory (should items be limited? Optionally?) and all access to buy from the shop

Message rooms based on hubot adpater name

When we call robot.sendMessage directly, use discord rooms for discord, single twitch channel for twitch and leave room for youtube, however that will work (likely similar to Twitch).

Moderation plugin

This gets hairy pretty quickly but a listener should do the job.

Current idea: create a list of rules that match messages and filter.

Filters:
https://www.npmjs.com/package/swearjar
MESSAGES IN ALL CAPS
Emoticon spam
Copy and paste spam (a fun scaling challenge for sure)
Link spam (particularly untrustworthy sites)

For the spam things, it should operate on a three strikes and you're out philosophy

Create command -> english middleware

Each plugin should look up a string from the !command and use that as the regular expression (in addition to the !command)

This is the groundwork for internationalization so keep that in mind when creating a data file.

More docs

CONFIGURATION.md should be written from the pov of a new repo.

Link that to DEPLOYMENT.md and talk about npm install.

PLUGINS.md needs a list of plugins and what they do.

DEPLOYMENT.md to be fleshed out as we have more ways to deploy.

Add namespacing to all keys

In preparation for multi-tenancy, we should namespace everything to the channel so we don't get users and other information crossed.

Discord channel/room madness

It has come to my attention that a bot using the same auth token will join all rooms it is authed to. This gets slightly complicated for hubot. We will need to experiment with how to detect the correct request/response across multiple guilds.

Rank/follower/subscriber only commands

Commands in the database can be for users with a particular rank, followers or subscribers only. Save this information alongside the existing commands.

Example for call-n-response
!learn [all,sub,follow,${rank}] command response

Create !time commands

!uptime - uptime of the stream (requires API integration)
!time - attendance time of the user (based on first watch value in user obj)
!checktime - check time of another user

Implement ranks

Admin only functionality

Dynamic addition of ranks with !addrank rank cost

Static addition of ranks on startup with loading a file. Use a timeout to ensure brain loading.

!buyrank user - subtract the appropriate amount from the user and give them that rank

How to create/enforce superseding ranks via command?

Create a battle royal system

From reddit:

Hello, I'm streaming a game that includes a battle royal system for me and 3 others to join in on. Currently the viewer pool is small enough for me to keep track of in my head, but it's still fairly hectic. I try to make it so that everyone has a fair chance to join in where last place in battle royal gets swapped out. While if multiple new viewers join, more people are swapped.

Giveaway plugin

Set number of credits required for entry.
Set number of entries per person.

Random chance of an individual winning the thing

Centralize moderator detection

Currently I have the same three lines of code all over the place. Let's put it in one place and that will allow the ability to switch it out for a more intelligent system.

HUBOT_TWITCH_ADMINS = process.env.HUBOT_TWITCH_ADMINS?.split "," || []
HUBOT_TWITCH_OWNERS = process.env.HUBOT_TWITCH_OWNERS?.split "," || []
moderators = HUBOT_TWITCH_ADMINS.concat HUBOT_TWITCH_OWNERS

Follow and join dates do not set on new users already in channel when bot starts

prattlr_1  |     at Viewership.exports.Viewership.Viewership.userEnter (/opt/prattlr/lib/viewership.coffee:31:38)
prattlr_1  |     at Listener.callback (/opt/prattlr/scripts/viewers.coffee:18:22)
prattlr_1  |     at /opt/prattlr/node_modules/hubot/src/listener.coffee:53:21
prattlr_1  |     at allDone (/opt/prattlr/node_modules/hubot/src/middleware.coffee:35:16)
prattlr_1  |     at /opt/prattlr/node_modules/hubot/node_modules/async/lib/async.js:274:13
prattlr_1  |     at Object.async.eachSeries (/opt/prattlr/node_modules/hubot/node_modules/async/lib/async.js:142:20)
prattlr_1  |     at Object.async.reduce (/opt/prattlr/node_modules/hubot/node_modules/async/lib/async.js:268:15)
prattlr_1  |     at /opt/prattlr/node_modules/hubot/src/middleware.coffee:39:24
prattlr_1  |     at nextTickCallbackWith0Args (node.js:436:9)
prattlr_1  |     at process._tickCallback (node.js:365:13)

This makes total sense because there is no check to see if the user exists. It is expected that the user will also be created on join.

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.