Compare commits

..

No commits in common. "master" and "next-tipbot" have entirely different histories.

3 changed files with 21 additions and 19 deletions

View file

@ -31,16 +31,16 @@ node move_helper.js
## Contributing ## Contributing
Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.tech/contribute](https://lbry.tech/contribute) Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.io/faq/contributing](https://lbry.io/faq/contributing)
## License ## License
This project is MIT Licensed © [LBRYio](https://github.com/lbryio) This project is MIT Licensed © [LBRYio](https://github.com/lbryio)
## Security ## Security
We take security seriously. Please contact security@lbry.com regarding any security issues. We take security seriously. Please contact security@lbry.io regarding any security issues.
Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it. Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.
## Contact ## Contact
The primary contact for this project is [@filipnyquist](https://github.com/filipnyquist) (filip@lbry.com) The primary contact for this project is [@filipnyquist](https://github.com/filipnyquist) (filip@lbry.io)

View file

@ -42,7 +42,7 @@ logger.info("Started LBRY twitter tipbot.");
stream.on("tweet", function(tweet) { stream.on("tweet", function(tweet) {
if(tweet.user.screen_name === config.get("bot.handle").substring(1)) return; if(tweet.user.screen_name === config.get("bot.handle").substring(1)) return;
let msg = checkTrunc(tweet); let msg = checkTrunc(tweet);
msg = msg.replace(/[\n\\]/g, " ").slice(msg.lastIndexOf(config.get("bot.handle"))).split(" "); msg = msg.slice(msg.indexOf(config.get("bot.handle"))).split(" ");
if (msg.length >= 2) checkTweet(tweet, msg); if (msg.length >= 2) checkTweet(tweet, msg);
}); });
@ -78,13 +78,13 @@ async function doHelp(tweet, msg) {
let post = await T.post("statuses/update", { let post = await T.post("statuses/update", {
status: status:
`@${tweet.user.screen_name} `+ `@${tweet.user.screen_name} `+
`Call commands with: ${config.get("bot.handle")} + \n` + `All commands should be called with ${config.get("bot.handle")} + subcommand \n` +
"help - Shows this command.\n" + "help - Shows this command. \n" +
"balance - Get your balance.\n" + "balance - Get your balance. \n" +
"deposit - Get address for your deposits.\n" + "deposit - Get address for your deposits. \n" +
"withdraw ADDRESS AMOUNT - Withdraw AMOUNT credits to ADDRESS.\n" + "withdraw ADDRESS AMOUNT - Withdraw AMOUNT credits to ADDRESS. \n" +
"tip USER AMOUNT - Tip USER AMOUNT.\n"+ "tip USER AMOUNT - Tip USER AMOUNT.\n"+
"terms - Sends the TOS.", "terms - Sends you the TOS.",
in_reply_to_status_id: tweet.id_str in_reply_to_status_id: tweet.id_str
}); });
logger.info( logger.info(
@ -123,7 +123,7 @@ async function doBalance(tweet, msg) {
async function doDeposit(tweet, msg) { async function doDeposit(tweet, msg) {
try { try {
const post = await T.post("statuses/update", { const post = await T.post("statuses/update", {
status: `@${tweet.user.screen_name} Your deposit address is ${await getAddress(id(tweet.user.id_str))}`, status: `@${tweet.user.screen_name} Your deposit address is ${await getAddress(id(tweet.user.id_str))}.`,
in_reply_to_status_id: tweet.id_str in_reply_to_status_id: tweet.id_str
}); });
logger.info( logger.info(
@ -189,7 +189,9 @@ async function doTip(tweet, msg) {
} }
const txId = await lbry.sendFrom(id(tweet.user.id_str), tipToAddress, Number(amount), 1); const txId = await lbry.sendFrom(id(tweet.user.id_str), tipToAddress, Number(amount), 1);
await T.post("statuses/update", { await T.post("statuses/update", {
status: `@${tweet.user.screen_name} Tipped ${amount} LBC! We'd say who it was to, but then Twitter would ban the bot. \nTransaction: ${txLink(txId)} \nSee https://lbry.com/faq/tipbot-twitter for more information.`, status: `@${tweet.user.screen_name} Tipped ${
msg[2]
} ${amount} LBC! \nTransaction: ${txLink(txId)} \nSee https://lbry.io/faq/tipbot-twitter for more information.`,
in_reply_to_status_id: tweet.id_str in_reply_to_status_id: tweet.id_str
}); });
logger.info( logger.info(
@ -221,7 +223,7 @@ function getValidatedAmount(amount) {
return amount.match(/^[0-9]+(\.[0-9]+)?$/) ? amount : null; return amount.match(/^[0-9]+(\.[0-9]+)?$/) ? amount : null;
} }
function txLink(txId) { function txLink(txId) {
return `https://explorer.lbry.com/tx/${txId}`; return `https://explorer.lbry.io/tx/${txId}`;
} }
function checkTrunc(tweet) { function checkTrunc(tweet) {
if (tweet.truncated) return tweet.extended_tweet.full_text; if (tweet.truncated) return tweet.extended_tweet.full_text;

View file

@ -213,8 +213,8 @@ env-variable@0.0.x:
resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.4.tgz#0d6280cf507d84242befe35a512b5ae4be77c54e" resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.4.tgz#0d6280cf507d84242befe35a512b5ae4be77c54e"
extend@~3.0.1: extend@~3.0.1:
version "3.0.2" version "3.0.1"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
extsprintf@1.3.0: extsprintf@1.3.0:
version "1.3.0" version "1.3.0"
@ -362,8 +362,8 @@ kuler@0.0.x:
colornames "0.0.2" colornames "0.0.2"
lodash@^4.0.0, lodash@^4.17.10: lodash@^4.0.0, lodash@^4.17.10:
version "4.17.19" version "4.17.10"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
logform@^1.6.0, logform@^1.9.0: logform@^1.6.0, logform@^1.9.0:
version "1.9.1" version "1.9.1"