Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 2.14 KB

README.md

File metadata and controls

75 lines (52 loc) · 2.14 KB

twircclient

Example code that shows how to use libtwirc

bot.c

A simple bot that connects to Twitch IRC and joins a channel. The source is well-commented, check it out.

client.c

A simple client that connectes to Twitch IRC and outputs all incoming messages on the console. Reads user input and sends it to the IRC server.

dump.c

A simple program that connects to a channel specified with -c #channel and dumps all chat messages to stdout. Optionally, a timestamp can be added with -t FORMAT, for example -t "[%H:%M:%S]"

How to

  1. Clone twircclient and libtwirc:
git clone https://github.com/domsson/twircclient
git clone https://github.com/domsson/libtwirc
  1. Build libtwirc with the provided build-shared script. It will output the .so and .h file into the lib subdirectory:
cd libtwirc
chmod +x build-shared
./build-shared
  1. Install libtwirc. This will vary depending on your distro and machine, as the include paths aren't the same for all. You'll have to look up where your distro wants shared library and header files. In any case, after copying the files to their appropriate directories, you should call ldconfig so that your system learns about the new library. For my amd64 Debian install, this does the trick (requires super user permissions):
cp lib/libtwirc.so /usr/lib/x86_64-linux-gnu/
cp lib/libtwirc.h /usr/include/
ldconfig -v -n /usr/lib
  1. Go over to the twircclient directory, create a token file and place your Twitch oauth token in there:
cd ../twircclient
touch token
echo "oauth:YOUR-TOKEN-HERE" > token
  1. Open src/bot.c or src/client.c (depending on which one you want to run) and edit the #defines to meet your needs:
#define NICK "your-twitch-username-here"
#define CHAN "#your-channel-here"
  1. Compile the bot and/or client and/or dumper:
chmod +x build-bot
chmod +x build-client
chmod +x build-dump
./build-bot
./build-client
./build-dump
  1. Run the bot and/or client and/or dumper:
./bin/bot
./bin/client
./bin/dump