Compare commits
19 commits
next-tipbo
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
b845c8099b | ||
|
7bba35a7f5 | ||
|
ba1ca3bce1 | ||
|
093a8fe67c | ||
|
7a4509fb90 | ||
|
b32f5eceb1 | ||
|
1fd5440499 | ||
|
d95b24be92 | ||
|
748d202a01 | ||
|
3f3bc693a0 | ||
|
804c7aed91 | ||
|
6bc58da4c0 | ||
|
b028aaf45f | ||
|
684011e2b6 | ||
|
9f17bc5b07 | ||
|
e16d827cec | ||
|
d88df331f1 | ||
|
b3a70dde59 | ||
|
05dc97bda8 |
3 changed files with 19 additions and 21 deletions
|
@ -31,16 +31,16 @@ node move_helper.js
|
|||
|
||||
## Contributing
|
||||
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.io/faq/contributing](https://lbry.io/faq/contributing)
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.tech/contribute](https://lbry.tech/contribute)
|
||||
|
||||
## License
|
||||
This project is MIT Licensed © [LBRYio](https://github.com/lbryio)
|
||||
|
||||
## Security
|
||||
|
||||
We take security seriously. Please contact security@lbry.io regarding any security issues.
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues.
|
||||
Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.
|
||||
|
||||
## Contact
|
||||
|
||||
The primary contact for this project is [@filipnyquist](https://github.com/filipnyquist) (filip@lbry.io)
|
||||
The primary contact for this project is [@filipnyquist](https://github.com/filipnyquist) (filip@lbry.com)
|
||||
|
|
26
index.js
26
index.js
|
@ -42,7 +42,7 @@ logger.info("Started LBRY twitter tipbot.");
|
|||
stream.on("tweet", function(tweet) {
|
||||
if(tweet.user.screen_name === config.get("bot.handle").substring(1)) return;
|
||||
let msg = checkTrunc(tweet);
|
||||
msg = msg.slice(msg.indexOf(config.get("bot.handle"))).split(" ");
|
||||
msg = msg.replace(/[\n\\]/g, " ").slice(msg.lastIndexOf(config.get("bot.handle"))).split(" ");
|
||||
if (msg.length >= 2) checkTweet(tweet, msg);
|
||||
});
|
||||
|
||||
|
@ -77,14 +77,14 @@ async function doHelp(tweet, msg) {
|
|||
try {
|
||||
let post = await T.post("statuses/update", {
|
||||
status:
|
||||
`@${tweet.user.screen_name} `+
|
||||
`All commands should be called with ${config.get("bot.handle")} + subcommand \n` +
|
||||
"help - Shows this command. \n" +
|
||||
"balance - Get your balance. \n" +
|
||||
"deposit - Get address for your deposits. \n" +
|
||||
"withdraw ADDRESS AMOUNT - Withdraw AMOUNT credits to ADDRESS. \n" +
|
||||
"tip USER AMOUNT - Tip USER AMOUNT.\n"+
|
||||
"terms - Sends you the TOS.",
|
||||
`@${tweet.user.screen_name} `+
|
||||
`Call commands with: ${config.get("bot.handle")} + \n` +
|
||||
"help - Shows this command.\n" +
|
||||
"balance - Get your balance.\n" +
|
||||
"deposit - Get address for your deposits.\n" +
|
||||
"withdraw ADDRESS AMOUNT - Withdraw AMOUNT credits to ADDRESS.\n" +
|
||||
"tip USER AMOUNT - Tip USER AMOUNT.\n"+
|
||||
"terms - Sends the TOS.",
|
||||
in_reply_to_status_id: tweet.id_str
|
||||
});
|
||||
logger.info(
|
||||
|
@ -123,7 +123,7 @@ async function doBalance(tweet, msg) {
|
|||
async function doDeposit(tweet, msg) {
|
||||
try {
|
||||
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
|
||||
});
|
||||
logger.info(
|
||||
|
@ -189,9 +189,7 @@ async function doTip(tweet, msg) {
|
|||
}
|
||||
const txId = await lbry.sendFrom(id(tweet.user.id_str), tipToAddress, Number(amount), 1);
|
||||
await T.post("statuses/update", {
|
||||
status: `@${tweet.user.screen_name} Tipped ${
|
||||
msg[2]
|
||||
} ${amount} LBC! \nTransaction: ${txLink(txId)} \nSee https://lbry.io/faq/tipbot-twitter for more information.`,
|
||||
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.`,
|
||||
in_reply_to_status_id: tweet.id_str
|
||||
});
|
||||
logger.info(
|
||||
|
@ -223,7 +221,7 @@ function getValidatedAmount(amount) {
|
|||
return amount.match(/^[0-9]+(\.[0-9]+)?$/) ? amount : null;
|
||||
}
|
||||
function txLink(txId) {
|
||||
return `https://explorer.lbry.io/tx/${txId}`;
|
||||
return `https://explorer.lbry.com/tx/${txId}`;
|
||||
}
|
||||
function checkTrunc(tweet) {
|
||||
if (tweet.truncated) return tweet.extended_tweet.full_text;
|
||||
|
|
|
@ -213,8 +213,8 @@ env-variable@0.0.x:
|
|||
resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.4.tgz#0d6280cf507d84242befe35a512b5ae4be77c54e"
|
||||
|
||||
extend@~3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
|
||||
|
||||
extsprintf@1.3.0:
|
||||
version "1.3.0"
|
||||
|
@ -362,8 +362,8 @@ kuler@0.0.x:
|
|||
colornames "0.0.2"
|
||||
|
||||
lodash@^4.0.0, lodash@^4.17.10:
|
||||
version "4.17.10"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
|
||||
version "4.17.19"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
|
||||
|
||||
logform@^1.6.0, logform@^1.9.0:
|
||||
version "1.9.1"
|
||||
|
|
Loading…
Reference in a new issue