Code Monkey home page Code Monkey logo

twitter-irc-bot's Introduction

note: twitter seems to have removed the ability to read tweets from the free tier of the v1.1 API, so if the bot isn't working, that's likely why

twitter-irc-bot (0.1.1)

this is an irc bot that previews tweets whenever a link to a tweet is posted in a channel

twitter-irc-bot

if you have img2irc installed, or use the included docker container, it can optionally show the profile picture of the user

required configuration

edit config.json.example, the irc and twitter sections are self-explanatory

note: you must do this first before proceding!

quickstart with docker

docker-compose up -d

running without docker

1) build and install img2irc (optional)

git clone https://github.com/anatolybazarov/img2irc

cd img2irc && cargo build --release

sudo cp target/release/img2irc /usr/local/bin

2) install npx and tsx if not installed already

sudo npm install -g npx

sudo npm install -g tsx

3) start twitter-irc-bot

npx tsx index.ts

commands

command argument function
!image on or off toggles whether the profile picture should be displayed
!width default is 10 the width of the profile picture
!len default is 400 the maximum number of characters for the tweet, after which it will truncate and add an ellipsis
!wrap default is 60 the number of characters after which to wrap the text, influences the width of the text box

optional configuration

img2irc

the bot.ansi section controls the arguments which will be sent to img2irc, and correspond to the command-line arguments which img2irc takes

for information about those arguments, see the usage details here

the default settings are

        "ansi": {
            "width": 10,
            "contrast": 30
        },

where width is the width of the profile picture, and contrast increases the contrast by 30 (max: 255)

for flags which do not take any arguments, simply set the value to true, e.g.,

        "ansi": {
            "width": 10,
            "contrast": 30,
            "sharpen": true
        },

text colours

you can change the colour of the display name, username, date, tweet text, retweets and likes

        "colors": {
            "name": "",
            "user": "",
            "date": "14",
            "text": "",
            "retweets": "09",
            "likes": "04"
        },

leaving the field blank means no explicit colour. here are the mirc colour codes

if the colour code is a single digit, you should pad it with a leading zero (e.g., 09 instead of 9)

symbols

you can modify which symbols to use for the retweets and likes as well

        "symbols": {
            "retweets": "↻",
            "likes": "❤"
        }

twitter-irc-bot's People

Contributors

waveplate avatar

Watchers

 avatar

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.