Giter Club home page Giter Club logo

twitchpixelpi's Introduction

Simple Twitch IRC bot to control a NeoPixel strip with commands.

Setup assumes GPIO pin 12 will be used for a neopixel strip, and that your strip is 60 pixels (use function_library.py if you need to change number of leds or gpio pin). If using a 16x16 matrix of neopixels, setup assumes GPIO pin 13 will be used. LED GND and MATRIX GND must be brought to the Pi's GND pin to avoid garbage data.

Twitch bot code came from here: https://pimylifeup.com/raspberry-pi-twitch-bot/

Neopixel code came from here: https://github.com/BSFEMA/RPi_WS2812

If you run into this error when trying to run the bot:

ImportError: No module named _rpi_ws281x

Do this:

sudo pip install rpi_ws281x

config.py needs to be edited as follows:

HOST = "irc.twitch.tv"              # This is Twitchs IRC server
PORT = 6667                         # Twitchs IRC server listens on port 6767
NICK = "twitch_username"            # Twitch username your using for your bot
CHAN = "#your_channel"                   # the channel you want the bot to join.

NICK is the twitch username the bot would be using (all letters in lowercase).

CHAN is the Twitch streamer account you want the bot to read and respond to (again, all letters in lowercase).

\secrets\secrets.py needs to be edited as follows:

PASS = "your_oauthtoken" # your Twitch OAuth token

PASS is the oauth token for the twitch account the bot would be using. Sign into a web browser with the bot's account,
and go here: https://twitchapps.com/tmi/ you need the whole oauth including the "oauth:"

To run the bot:

sudo python3 main.py

To run the bot as a service, and set it to start automatically at boot:

Create a new file for the service:

sudo nano /etc/systemd/system/twitchbot.service

Copy /Paste this code chunk into it:

[Unit]
Description=twitch bot
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=python3 /home/pi/twitchpixelpi/main.py

[Install]
WantedBy=multi-user.target

Ctrl+O to write out the file (save) then Ctrl+X to exit nano.

To start the service:

sudo service twitchbot start

To stop the service:

sudo service twitchbot stop

To make the service start at boot:

sudo systemctl enable twitchbot

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.