Git Product home page Git Product logo

twitter-tipbot's Introduction

Twitter tipbot - A twitter tipbot for LBRY

This repo contains the twitter tipbot used by LBRY. This bot allows users to tip each other LBC on twitter.

Installation

Prerequisites

  • Lbrycrd-daemon
  • Node.js v8+
  • Yarn
  • A twitter application on the tipbot account

To get started you should clone the git:

git clone https://github.com/lbryio/twitter-tipbot

Install all modules with yarn:

yarn install

Rename default.example.json to default.json and enter the twitter tokens and daemon settings.

Run the bot with:

node index.js

If you want to move over accounts from the old tipbot format which used usernames as identifier, run move_helper.js:

node move_helper.js

It will automatically move over the old accounts to the new id based system.

Contributing

Contributions to this project are welcome, encouraged, and compensated. For more details, see lbry.tech/contribute

License

This project is MIT Licensed © LBRYio

Security

We take security seriously. Please contact [email protected] regarding any security issues. Our PGP key is here if you need it.

Contact

The primary contact for this project is @filipnyquist ([email protected])

twitter-tipbot's People

Contributors

filipnyquist avatar nikooo777 avatar nftbuilder avatar tzarebczan avatar dependabot[bot] avatar eatdostacos avatar

Stargazers

 avatar  avatar  avatar Fajar van Megen avatar gasolin avatar Joel Robert Justiawan avatar Harrison Mayotte avatar

Watchers

John B Nelson avatar Alex Grin avatar James Cloos avatar Shawn K avatar Victor Shyba avatar  avatar K. Kurokawa avatar Anthony avatar Jeffrey Picard avatar  avatar Jack Robison avatar Josh Finer avatar Alyssa Callahan avatar  avatar

twitter-tipbot's Issues

Issues withdrawing with certain balances

Two users recently came across an issue withdrawing their Twitter tipbot balance. I've narrowed it down to being related to the balance amount since this tipbot tries to withdraw the entire amount. This usually happens after a user withdrew, has a negative balance, then is tipped again, and tries to withdraw. One example: "twttr-xxxxxx": 4.99999580

We should round up to 3 digits or so when withdrawing, this might fix the problem. Not sure how Discord tipbot deals with the same issue, but there we withdraw certain amounts, not the entire one.

Switch account system to use internal Twitter IDs

The current tipbot uses Twitter usernames as the accounting id. This becomes an issue if a tipbot user changes their Twitter username (I don't think this will happen often and we'd have a manual workaround if it does).

After making this change, we should be able to transfer the accounts from user id to internal id - I can do this manually.

Allow interactions via DM

As a Twitter user, it feels awkward for me to make public tweets to check my balance or get a deposit address. I would prefer to communicate via direct message.

Better UX around depositing credits

As someone putting credits in to tip right away, it is confusing to know at what point they can be tipped.

It could be cool if the bot DM'ed/tweeted something like:

  • "Your deposit has been noticed by our bot. It will be spendable in approx 15 min (after 6 block confirmations)."
  • "Your deposit has been confirmed. Tip freely!"

Investigate removal of "lbryian" keyword

Currently, you need to tag @LBC_Tipbot and start the message with "lbryian" + command to use the tipbot. The Twitter API uses this keyword while listening for commands. Should be possible to improve this behavior so you just have to tweet "@LBC_Tipbot deposit".

Research: Support new Twitter API

The streaming API is going away sometime in August, which I believe we are using. We may need to pay for new API access and reconfigure the bot to use it.

Handle missing tip username better

Currently if you just write "lbryian tip 10", the bot doesn't reply or give any hints to the user about having to include the tip username. It should handle the error and reply back with the proper syntax for tipping.

The response in the twitter log is:
{"message":" ","stack":"TypeError: Cannot read property '0' of null\n at Parser. (/home/ubuntu/twitter-tipbot/bin/tipbot.js:142:34)\n at emitOne (events.js:116:13)\n at Parser.emit (events.js:211:7)\n at Parser.receive (/home/ubuntu/twitter-tipbot/node_modules/twitter/lib/parser.js:58:16)\n at IncomingMessage. (/home/ubuntu/twitter-tipbot/node_modules/twitter/lib/twitter.js:284:14)\n at emitOne (events.js:121:20)\n at IncomingMessage.emit (events.js:211:7)\n at addChunk (_stream_readable.js:263:12)\n at readableAddChunk (_stream_readable.js:250:11)\n at IncomingMessage.Readable.push (_stream_readable.js:208:10)","source":{"created_at":"Mon Apr 30 17:54:36 +0000 2018","id":991012959278288900,"id_str":"991012959278288898","text":"@ICTman1076 @lbryio @LBC_TipBot Let's try that again:\n\n@LBC_TipBot lbryian tip 10","display_text_range":[32,81],"source":"<a href="http://twitter.com\" rel="nofollow">Twitter Web Client","truncated":false,"in_reply_to_status_id":991011660776132600,"in_reply_to_status_id_str":"991011660776132608","in_reply_to_user_id":58914498,"in_reply_to_user_id_str":"58914498","in_reply_to_screen_name":"TomZarebczan","user":{"id":58914498,"id_str":"58914498","name":"Thomas Zarebczan 📚","screen_name":"TomZarebczan","location":"USA","url":"http://lbry.io/get","description":"Community and Quality Manager at LBRY, Cryptocurrency enthusiast, miner and overall tech geek","translator_type":"none","protected":false,"verified":false,"followers_count":1702,"friends_count":629,"listed_count":80,"favourites_count":13370,"statuses_count":7452,"created_at":"Tue Jul 21 20:42:08 +0000 2009","utc_offset":-14400,"time_zone":"Eastern Time (US & Canada)","geo_enabled":true,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"000000","profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","profile_background_tile":false,"profile_link_color":"19CF86","profile_sidebar_border_color":"000000","profile_sidebar_fill_color":"000000","profile_text_color":"000000","profile_use_background_image":false,"profile_image_url":"http://pbs.twimg.com/profile_images/826278270085668864/0bkDxxJy_normal.jpg","profile_image_url_https":"https://pbs.twimg.com/profile_images/826278270085668864/0bkDxxJy_normal.jpg","profile_banner_url":"https://pbs.twimg.com/profile_banners/58914498/1520005836","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"is_quote_status":false,"quote_count":0,"reply_count":0,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"urls":[],"user_mentions":[{"screen_name":"ICTman1076","name":"ICTman1076 🛡","id":2404934239,"id_str":"2404934239","indices":[0,11]},{"screen_name":"LBRYio","name":"LBRY","id":2863324024,"id_str":"2863324024","indices":[12,19]},{"screen_name":"LBC_TipBot","name":"LBC_TipBot","id":968503155465113600,"id_str":"968503155465113600","indices":[20,31]},{"screen_name":"LBC_TipBot","name":"LBC_TipBot","id":968503155465113600,"id_str":"968503155465113600","indices":[55,66]}],"symbols":[]},"favorited":false,"retweeted":false,"filter_level":"low","lang":"en","timestamp_ms":"1525110876279"},"level":"error","timestamp":"2018-04-30T17:54:36.574Z"}

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.