Arduino library to connect your project to IRC (Internet Relay Chat)

Related tags

Arduino ArduinoIRC
Overview

IRC Client Library for Arduino Build Status

Connects your arduino project to an IRC server.

Features

  • Easy connection to an IRC server through a Client implementation;

  • Receive parsed IRC messages through a callback function;

  • Send raw messages to the server or messages to a channel or user;

  • Supports Twitch Chat

Usage

See the examples…​

Contribution

Just send a pull request! :)

License

Copyright (c) 2016 Fredi Machado. All right reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

You might also like...
Arduino web server library.

aWOT Arduino web server library. Documentation 1. Getting started Hello World Basic routing Application generator Serving static files 2. Guide Routin

Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485
Arduino, esp32 and esp8266 library for ABB (ex PowerOne) Aurora Inverter, implement a full methods to retrieve data from the Inverter via RS-485

ABB Aurora protocol You can refer the complete documentation on my site ABB Aurora PV inverter library for Arduino, esp8266 and esp32 I create this li

Arduino library for the MCP2515 CAN Controller

MCP2515 CAN Controller Library for Arduino Compatibility with the ACAN library This library is fully compatible with the Teensy 3.x ACAN library https

CAN / CANFD Arduino Library for Teensy 4.0

CAN Library for Teensy 4.0 / 4.1 It handles Controller Area Network (CAN) for CAN1, CAN2 and CAN3, and Controller Area Network with Flexible Data (CAN

Analog Devices Analog Digital Converter AD7173 Arduino library

AD7173-Arduino Analog Devices AD7173 analog digital converter Arduino library Mostly tested setup for this library: 1007 data rate external crystal co

Arduino library for nRF51822-based Adafruit Bluefruit LE modules

This library is for all nRF51 based Adafruit Bluefruit LE modules that use SPI or UART. Current nRF51 based Bluefruit LE products include: Bluefruit L

Arduino library for the Adafruit FONA

Adafruit FONA Library This library requires Arduino v1.0.6 or higher This is a library for the Adafruit FONA Cellular GSM Breakouts etc Designed speci

Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.

Adafruit IO Arduino Library This library provides a simple device independent interface for interacting with Adafruit IO using Arduino. It allows you

Arduino library for MQTT support

Adafruit MQTT Library Arduino library for MQTT support, including access to Adafruit IO. Works with the Adafruit FONA, Arduino Yun, ESP8266 Arduino pl

Comments
  • Added Twitch Support

    Added Twitch Support

    • Added support for connecting to Twitch Chat
    • Added basic example for twitch chat
    • Re-organized examples
    • Updated version number to 0.2.0

    Thanks for the library!

    opened by witnessmenow 7
  • How to enter channel with pass register?

    How to enter channel with pass register?

    I will like to enterró IRC channel with my register user into a channel. Then I will monitorized the messages and when a messages be the same a text, for example "help" then a led will turn ON and I will enter.

    In the same way I will like to send some predefined text with buttons.

    What do you think about this?

    opened by AnakinSpain 4
  • Remove invalid reference link from keywords.txt

    Remove invalid reference link from keywords.txt

    The third field of keywords.txt is used to provide Arduino Language/Libraries Reference links, which are accessed from the Arduino IDE by highlighting the keyword and then selecting "Find in Reference" from the Help or right click menu. Adding values to this field that do not match any existing reference pages results in a "Could not open the URL" error.

    Reference: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywordstxt-format

    opened by per1234 1
  • [I][WiFiClient.cpp:548] connected(): Unexpected: RES: 0, ERR: 119 (ESP32)

    [I][WiFiClient.cpp:548] connected(): Unexpected: RES: 0, ERR: 119 (ESP32)

    I know this is setup for an ESP8266, however I can't seem to find anywhere else to help with the error message I am getting:

    Description

    Basically, this all works without issue on an ESP8266, but using the 32 I am able to connect to the twitch chat then my wifi disconnects and I get:

    [I][WiFiClient.cpp:548] connected(): Unexpected: RES: 0, ERR: 119

    Troubleshooting

    Removing all the twitch code so it is just simple code to connect to the internet with wifi works without issue. I have serial confirm the IP address every 5 minutes and can confirm it is connected to my router. Could be related to the wifi.h and IRCClient.h being used together?

    Board

    I'm using a Wemos Lolin32 Lite , DOIT ESP32 Dev Kit V1 generic ESP32 etc. Arduino 1.8.12

    Sketch

    /*******************************************************************
        Connect to Twtich Chat with a Bot
    
       Created with code from TheOtherLoneStar (https://www.twitch.tv/theotherlonestar)
       Hackaday IO: https://hackaday.io/otherlonestar
    
       By Brian Lough (https://www.twitch.tv/brianlough)
       YouTube: https://www.youtube.com/channel/UCezJOfu7OtqGzd5xrP3q6WA
     *******************************************************************/
    
    #include <WiFi.h>          //https://github.com/esp8266/Arduino
    #include <IRCClient.h>
    
    //define your default values here, if there are different values in config.json, they are overwritten.
    
    #define IRC_SERVER   "irc.chat.twitch.tv"
    #define IRC_PORT     6667
    
    //------- Replace the following! ------
    char ssid[] = "ssid";       // your network SSID (name)
    char password[] = "pass";  // your network key
    
    //The name of the channel that you want the bot to join
    const String twitchChannelName = "mytwitchchannel";
    
    //The name that you want the bot to have
    #define TWITCH_BOT_NAME "mytwitchbot"
    
    //OAuth Key for your twitch bot
    // https://twitchapps.com/tmi/
    #define TWITCH_OAUTH_TOKEN "oauth:xxxxxxxxxxxxxxxxxxxxxx
    
    
    //------------------------------
    
    
    int led = LED_BUILTIN;
    String ircChannel = "";
    
    WiFiClient wiFiClient;
    IRCClient client(IRC_SERVER, IRC_PORT, wiFiClient);
    
    // put your setup code here, to run once:
    void setup() {
      Serial.begin(115200);
    
      pinMode(led, OUTPUT);
      Serial.println();
    
    
      // Attempt to connect to Wifi network:
      Serial.print("Connecting Wifi: ");
      Serial.println(ssid);
      WiFi.begin(ssid, password);
      while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(500);
      }
      Serial.println("");
      Serial.println("WiFi connected");
      Serial.println("IP address: ");
      IPAddress ip = WiFi.localIP();
      Serial.println(ip);
    
      ircChannel = "#" + twitchChannelName;
    
      client.setCallback(callback);
    }
    
    void loop() {
    
      // Try to connect to chat. If it loses connection try again
      if (!client.connected()) {
        Serial.println("Attempting to connect to " + ircChannel );
        // Attempt to connect
        // Second param is not needed by Twtich
        if (client.connect(TWITCH_BOT_NAME, "", TWITCH_OAUTH_TOKEN)) {
          client.sendRaw("JOIN " + ircChannel);
          Serial.println("connected and ready to rock");
          sendTwitchMessage("Oh no, that boi connected");
          delay(5000);
        } else {
          Serial.println("failed... try again in 5 seconds");
          // Wait 5 seconds before retrying
          delay(5000);
        }
        return;
      }
      client.loop();
    }
    
    void sendTwitchMessage(String message) {
      client.sendMessage(ircChannel, message);
    }
    
    
    void callback(IRCMessage ircMessage) {
      //Serial.println("In CallBack");
    
      if (ircMessage.command == "PRIVMSG" && ircMessage.text[0] != '\001') {
        //Serial.println("Passed private message.");
        ircMessage.nick.toUpperCase();
    
        String message("<" + ircMessage.nick + "> " + ircMessage.text);
    
        //prints chat to serial
        Serial.println(message);
    
        for (int i = 0; i < 6; i++) {
          digitalWrite(led, HIGH);
          delay(50);
          digitalWrite(led, LOW);
          delay(25);
        }
    
        return;
      }
    }
    

    ###Debug message:

    09:36:18.215 -> Connecting Wifi: SLOWKEVIN
    09:36:18.215 -> [    58][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY
    09:36:18.308 -> [   147][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
    09:36:18.355 -> [   145][V][WiFiGeneric.cpp:338] _arduino_event_cb(): STA Started
    09:36:18.355 -> [   153][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 2 - STA_START
    09:36:18.355 -> .[   419][V][WiFiGeneric.cpp:353] _arduino_event_cb(): STA Connected: SSID: MYWIFI, BSSID: 10:0c:6b:e2:89:b2, Channel: 1, Auth: WPA2_PSK
    09:36:18.591 -> [   420][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
    09:36:18.827 -> ....[  2551][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got New IP:192.168.1.42
    09:36:20.746 -> [  2551][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
    09:36:20.746 -> [  2554][D][WiFiGeneric.cpp:991] _eventCallback(): STA IP: 192.168.1.42, MASK: 255.255.255.0, GW: 192.168.1.1
    09:36:20.841 -> 
    09:36:20.841 -> WiFi connected
    09:36:20.841 -> IP address: 
    09:36:20.841 -> 192.168.1.42
    09:36:20.841 -> Attempting to connect to #Mytwitchchannel
    09:36:21.077 -> connected and ready to rock
    09:36:26.047 -> [  7885][I][WiFiClient.cpp:548] connected(): Unexpected: RES: 0, ERR: 119
    09:36:26.047 -> [  7886][I][WiFiClient.cpp:548] connected(): Unexpected: RES: 0, ERR: 119
    

    Lastly

    This code and the things you provide have been so helpful in learning about Arduino and have helped me make a bunch of things I would never have dreamed of without the ideas and functionality of code like this !!! you ROCK!

    opened by DisasterofPuppets 1
Releases(0.2.0)
  • 0.2.0(Aug 7, 2018)

    Added PASS support

    Thanks to Brian Lough (@witnessmenow) for implementing this feature.

    • Now we're able to connect to Twitch chat
    • There's a really nice example on how to do that
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Apr 9, 2016)

  • 0.0.2(Apr 5, 2016)

    This version allows you to connect to an IRC server and use a callback to receive IRC messages. The IRC message is very complete, containing nick, user, host, command, parameters and text. You can also send raw data to the server and messages (PRIVMSG). See examples.

    Source code(tar.gz)
    Source code(zip)
Owner
Fredi Machado
Husband, father, software engineer, electronics geek, guitarist, fascinated by technology and astronomy.
Fredi Machado
ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT Cloud

ArduinoIoTCloud What? The ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT

Arduino Libraries 64 Dec 16, 2022
Examples of how to connect various Arduino boards to cloud providers.

Arduino Cloud Provider Examples Examples of how to connect various Arduino boards to cloud providers. Related tutorials on Arduino Project Hub: AWS: S

Arduino 61 Nov 8, 2022
Arduino Arduino library for the CloudStorage server project. The library provides easy access to server-stored values and operations.

Arduino-CloudStorage Arduino/ESP8266 library that allows you to easly store and retreive data from a remote (cloud) storage in a key/value fashion. Cl

Gil Maimon 7 Jan 30, 2022
IOTBOT, which is designed as an Internet-oriented robotic coding training kit and powered by the ESP32 processor

IOTBOT-Firmware! Test Series IOTBOT, which is designed as an Internet-oriented robotic coding training kit and powered by the ESP32 processor, knows n

null 1 Dec 29, 2021
Arduino library for making an IHC in or output module using an Arduino

Introduction This is an Arduino library for making an IHC in or output module using an Arduino. (IHC controller is a home automation controller made b

Jens Østergaard Nielsen 2 Mar 26, 2020
♾ AllThingsTalk Arduino SDK for your LoRa Devices

AllThingsTalk Arduino LoRaWAN SDK AllThingsTalk Arduino Library for LoRa Devices - makes connecting devices with AllThingsTalk Maker a breeze. AllThin

AllThingsTalk 2 Sep 14, 2022
Arduino polyphonic synthesizer project (not a Moog) for ESP32 - STM32 - Teensy and more

ml_synth_basic_example Arduino polyphonic synthesizer project (not a Moog) for ESP32 - STM32 - Teensy and more link to the video My intention was to m

Marcel 18 Dec 7, 2022
Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames.

107-Arduino-MCP2515 Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames. This library is prepared to interface easily

107-Systems 51 Nov 16, 2022
Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages.

107-Arduino-NMEA-Parser Arduino library for interfacing with any GPS, GLONASS, Galileo or GNSS module and interpreting its NMEA messages. This library

107-Systems 15 Jan 1, 2023
Arduino library for providing a convenient C++ interface for accessing UAVCAN.

107-Arduino-UAVCAN Arduino library for providing a convenient C++ interface for accessing UAVCAN (v1.0-beta) utilizing libcanard. This library works f

107-Systems 54 Jan 2, 2023