Giter VIP home page Giter VIP logo

rubytwitch's Introduction

RubyTwitch

Twitch chatbot written in Ruby.


Features

  • Threading

  • Global ban protection

  • Easy command management

  • Color output


Setup

Create a file called credentials.txt, add the following three lines to it:

oauth:some_long_token_here
botname
channel

Of course you're going to replace the oauth token, botname and channel with your own values.

That's it! Now you can run it, either by double clicking main.rb or by running ruby main.rb from the console.


Configuration

The first couple of lines in configurator.rb contains two global variables. prefix and max_messages.

prefix is the symbol a person in chat uses to trigger a command.

max_messages is the max amount of messages to keep in the queue which the chat bot is going to respond to.


To-Do

  • Add API commands

  • Add delay between requests

  • Add response loading from files

rubytwitch's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rubytwitch's Issues

.downcase! parsing error

lines 51 and 52 of CommandsHandler.rb reads
original_message.strip! message = original_message.downcase!

we see .strip! being used to remove any additional spaces after the message and save that in original_message. -good, this is proper..

next on line 52 we see .downcase! being used to save original_message in all lower case, AND save that to a new variable message.. - This is not going to work..

downcase! returns a string ONLY IF it had to change anything.. otherwise it returns NIL.

This attempt at double duty (updating original message and making a copy of it into a new variable message) will result in message being nil when the original_message had no capital letters in it...

if updating original_message is not important changing this line to
message = original_message.downcase
will work just fine..

however original_message is used again further in the code implying that it should too be downcase.
to solve this.. we should simply add
original_message.downcase!
below
original_message.strip!

and then update
message = original_message.downcase!
to simply...
message = original_message OR message = original_message.dup(if changes should not effect eachother)

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.