Giter VIP home page Giter VIP logo

twitch-plays's Introduction

Twitch Plays hackRU

twitch_plays_hackru is a Python library for twitch chatters to be able to vote on commands in a game.

Important NOTE

DON'T UPLOAD YOUR OATH TOKEN TO GITHUB it gives api acces to your account and somone can use your account without your permission if its public. also if you are submitting a hack, we don't need your oath key, we will enter our own for our demo stream so don't worry.

Installation

pip3 install twitch_plays_hackru.

Usage

Importing the classes:

from twitch_plays_hackru import TwitchPlaysOnline, TwitchPlaysOffline

Initializing the TwitchPlaysOnline or TwitchPlaysOffline object:

twitch_options = {
    "PASS": "oauth:YOUR_OATH_CODE_HERE",
    "BOT": "TwitchPlaysBot",
    "CHANNEL": "YOUR_CHANNEL_NAME_HERE",
    "OWNER": "YOUR_CHANNEL_NAME_HERE",
    "OPTIONS": ["1","2","3","hi","bye"],
    "VOTE_INTERVAL": 5
}
tPlays = TwitchPlaysOnline(**twitch_options)
# or
tPlays = TwitchPlaysOnline(
    PASS="oauth:YOUR_OATH_CODE_HERE",
    BOT="TwitchPlaysBot",
    CHANNEL="YOUR_CHANNEL_NAME_HERE",
    OWNER="YOUR_CHANNEL_NAME_HERE",
    OPTIONS=["1","2","3","hi","bye"],
    VOTE_INTERVAL=5)

The object will take in 7 parameters:
only VOTE_INTERVAL and OPTIONS are needed for the offline version SERVER: the server that the bot will be interacting with. In this case it will always be "irc.twitch.tv" (the default)
PORT: the port you would like use. defaults to 6667
PASS: the OAuth code for the twitch channel you would like this bot to listen on. Use twitchapp.com/tmi/ to generate the OAuth code for your twitch channel.
BOT: the nickname of the bot.
CHANNEL: the name of the channel you would like this bot to listen on.
OWNER: the username of the owner of the channel you would like this bot to listen on.
OPTIONS = []: an array of options that you would like the bot to keep track of. VOTE_INTERVAL: how often you want to count up the votes. defaults to every 5 seconds

Chatters voting:

The initialization of the bot will also startup the bot. This means that the bot will send a "Hello World" message in the chat and then begin to listen to all of the chat responses.
Chatters will preface their vote option by using play_ . For example, a vote for hi from the code above must be typed play_hi. It is not case sensitive.

Functions:

vote_results():

result = tPlays.vote_results()

vote_results() returns the majority vote since the last count. if a count has not been completed it will return null the whole idea behind this library is that vote_results acts like pygame.key.get_pressed() which makes it easy to develop a game with

License

GNU

twitch-plays's People

Contributors

jeff1216 avatar mjrb avatar

Watchers

 avatar James Cloos avatar  avatar Heman Gandhi avatar Lincoln Roth avatar  avatar Lucent Fong avatar  avatar

Forkers

danielcolepk

twitch-plays's Issues

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.