Merge remote-tracking branch 'origin/master' into commands-cleanup

This commit is contained in:
Niko Storni 2017-12-19 00:34:27 +01:00
commit ed28f2ad57
5 changed files with 263 additions and 80 deletions

View file

@ -17,7 +17,7 @@ exports.commands = [
"name", "name",
"mining", "mining",
"pricestance", "pricestance",
"publisher", "youtuber",
"publish", "publish",
"random", "random",
"referrals", "referrals",
@ -36,17 +36,20 @@ exports.commands = [
"email", "email",
"cli", "cli",
"ipfstorrent" "ipfstorrent"
"shapeshift"
"youtube"
"transactions"
]; ];
exports.helpcommands = { exports.helpcommands = {
usage: " ", usage: " ",
description: description:
"Displays Helpful Commands:\n!what, !beta, !begging, !github, !appdownload, !daemondownload, !directories, !faq, !name, !mining, !pricestance, !publisher, !publish, !random, !referrals, !rewards, !rewardsvsreferrals, !cc, !verify, !verification, !logfile, !backup, !startup, !streamingissues, !ports, !migrate, !tipping, !email, !cli, !ipfstorrent", "Displays Helpful Commands:\n!what, !beta, !begging, !github, !appdownload, !daemondownload, !directories, !faq, !name, !mining, !pricestance, !youtuber, !publish, !random, !referrals, !rewards, !rewardsvsreferrals, !cc, !verify, !verification, !logfile, !backup, !startup, !streamingissues, !ports, !migrate, !tipping, !email, !cli, !ipfstorrent, !shapeshift, !youtube, !transactions",
process: function(bot, msg) { process: function(bot, msg) {
msg.channel.send({ msg.channel.send({
embed: { embed: {
description: description:
"**!what, !beta, !begging, !github, !appdownload, !daemondownload, !directories, !faq, !name, !mining, !pricestance, !publisher, !publish, !random, !referrals, !rewards, !rewardsvsreferrals, !cc, !verify, !verification, !logfile, !backup, !startup, !streamingissues, !ports, !migrate, !tipping, !email, !cli, !ipfstorrent**", "**!what, !beta, !begging, !github, !appdownload, !daemondownload, !directories, !faq, !name, !mining, !pricestance, !youtuber, !publish, !random, !referrals, !rewards, !rewardsvsreferrals, !cc, !verify, !verification, !logfile, !backup, !startup, !streamingissues, !ports, !migrate, !tipping, !email, !cli, !ipfstorrent, !shapeshift, !youtube, !transactions**",
color: 7976557, color: 7976557,
author: { author: {
name: "List of Helpful LBRY Commands", name: "List of Helpful LBRY Commands",
@ -268,17 +271,17 @@ exports.pricestance = {
} }
}; };
exports.publisher = { exports.youtuber = {
usage: " ", usage: " ",
description: "Interested in publishing on LBRY?", description: "Are you a Youtuber curious about LBRY?",
process: function(bot, msg) { process: function(bot, msg) {
const embed = { const embed = {
description: description:
"Interested in publishing on LBRY? Have a look at [lbry.io/publish](https://lbry.io/publish)", "Are you a Youtuber curious about LBRY? Have a look at [lbry.io/youtube](https://lbry.io/youtube)",
color: 7976557, color: 7976557,
author: { author: {
name: "Want to Publish?", name: "Are you a Youtuber?",
url: "https://lbry.io/publish", url: "https://lbry.io/youtube",
icon_url: "https://i.imgur.com/yWf5USu.png" icon_url: "https://i.imgur.com/yWf5USu.png"
} }
}; };
@ -346,11 +349,11 @@ exports.rewards = {
process: function(bot, msg) { process: function(bot, msg) {
const embed = { const embed = {
description: description:
"Rewards are given to legitimate users who are using the system (and in turn are testing things for us). In order to redeem rewards, you may need to verify your identity through a Credit Card or other manual methods.\n Please see [lbry.io/faq/identity-requirements](https://lbry.io/faq/identity-requirements)", "[Rewards](https://lbry.io/faq/rewards) are given to legitimate users who are using the system (and in turn are testing things for us). In order to redeem rewards, you may need to verify your identity through a Credit Card or other manual methods.\n Please see [lbry.io/faq/identity-requirements](https://lbry.io/faq/identity-requirements)",
color: 7976557, color: 7976557,
author: { author: {
name: "Rewards", name: "Rewards",
url: "https://lbry.io/faq/identity-requirements", url: "https://lbry.io/faq/rewards",
icon_url: "https://i.imgur.com/yWf5USu.png" icon_url: "https://i.imgur.com/yWf5USu.png"
} }
}; };
@ -417,18 +420,18 @@ exports.verification = {
var message = var message =
"If you would like to be verified go to <#" + "If you would like to be verified go to <#" +
verificationChannel + verificationChannel +
">. After joining, post that you would like verification and a mod will get to your request as soon as possible. We appreciate your patience. Only one account per person is allowed access to LBRY Rewards. This channel is not for YouTube sync, which is a separate process that requires a minimum number of views on Youtube (If you restarted LBRY and didn't get verified, you most likely don't qualify)."; ">. After joining, post that you would like verification and a mod will get to your request as soon as possible. We appreciate your patience. Only one account per person is allowed access to LBRY Rewards. Check out our [YouTube Sync](https://lbry.io/faq/youtube) for assistance with the YouTube Sync rewards verification method.";
msg.channel.send(message); msg.channel.send(message);
} }
}; };
exports.logfile = { exports.logfile = {
usage: " ", usage: " ",
description: "How to fine LBRY-app Log File?", description: "How to find LBRY-app Log File?",
process: function(bot, msg) { process: function(bot, msg) {
const embed = { const embed = {
description: description:
"You can find your log files by following the tutorial [HERE](https://lbry.io/faq/how-to-find-lbry-log-file)", "You can find your log files by following the guide [HERE](https://lbry.io/faq/how-to-find-lbry-log-file)",
color: 7976557, color: 7976557,
author: { author: {
name: "How to find my LogFile?", name: "How to find my LogFile?",
@ -621,3 +624,63 @@ exports.ipfstorrent = {
}); });
} }
}; };
exports.shapeshift = {
usage: " ",
description: "How can I convert my crypto into LBC?",
process: function(bot, msg) {
const embed = {
description:
"Please see this guide on how to convert your crypto into LBC: [lbry.io/faq/shapeshift](https://lbry.io/faq/shapeshift)",
color: 7976557,
author: {
name: "How can I convert my crypto into LBC?",
url: "https://lbry.io/faq/shapeshift",
icon_url: "https://i.imgur.com/yWf5USu.png"
}
};
msg.channel.send({
embed
});
}
};
exports.youtube = {
usage: " ",
description: "What is YouTube Sync?",
process: function(bot, msg) {
const embed = {
description:
"Please see this guide on how youtube sync works, check out [lbry.io/faq/youtube](https://lbry.io/faq/youtube)",
color: 7976557,
author: {
name: "What is YouTube Sync?",
url: "https://lbry.io/faq/youtube",
icon_url: "https://i.imgur.com/yWf5USu.png"
}
};
msg.channel.send({
embed
});
}
};
exports.transactions = {
usage: " ",
description: "What types of LBRY transactions are there?",
process: function(bot, msg) {
const embed = {
description:
"Please see this guide on [transaction types](https://lbry.io/faq/transaction-types)",
color: 7976557,
author: {
name: "What types of LBRY transactions are there?",
url: "https://lbry.io/faq/transaction-types",
icon_url: "https://i.imgur.com/yWf5USu.png"
}
};
msg.channel.send({
embed
});
}
};

View file

@ -13,7 +13,10 @@ exports.lbrylink = function(bot, msg, suffix) {
if (link != -1) { if (link != -1) {
var text = msg.content.replace("lbry://", "https://open.lbry.io/"); var text = msg.content.replace("lbry://", "https://open.lbry.io/");
var message = GetWordByPos(text, link); var message = GetWordByPos(text, link);
if (text.search("<") != -1) { if (message === "https://open.lbry.io/") {
return;
}
if (message.search("<") != -1) {
var name = "@" + msg.mentions.members.first().user.username; var name = "@" + msg.mentions.members.first().user.username;
var trim = message.split("/").pop(); var trim = message.split("/").pop();
var trim2 = trim.substr(2); var trim2 = trim.substr(2);
@ -49,8 +52,7 @@ exports.lbrylink = function(bot, msg, suffix) {
} }
const embed = { const embed = {
description: description:
msg.author + "I see you tried to post a LBRY URL, here's a friendly hyperlink to share and for others to access your content with a single click: \n" +
", I see you tried to post a LBRY URL, here's a friendly hyperlink to share and for others to access your content with a single click: \n" +
"[lbry://" + "[lbry://" +
newname + newname +
"](" + "](" +

View file

@ -29,33 +29,138 @@ exports.releasenotes = {
releasename = JSON.parse(body).name; releasename = JSON.parse(body).name;
releasedate = JSON.parse(body).published_at; releasedate = JSON.parse(body).published_at;
releaseurl = JSON.parse(body).html_url; releaseurl = JSON.parse(body).html_url;
message = { if (releasemessage.length < 2000) {
embed: { message = {
title: "*Download " + releasename + " here!*", embed: {
description: releasemessage, title: "*Download " + releasename + " here!*",
url: releaseurl, description: releasemessage,
color: 7976557, url: releaseurl,
timestamp: releasedate, color: 7976557,
author: { timestamp: releasedate,
name: "Lbry-app Release Notes for " + releasename, author: {
icon_url: name: "Lbry-app Release Notes for " + releasename,
"http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png" icon_url: "http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png"
}, },
footer: { footer: {
icon_url: "https://i.imgur.com/yWf5USu.png", icon_url: "https://i.imgur.com/yWf5USu.png",
text: "Lbry-app Updated " text: "Lbry-app Updated "
}
} }
};
if (inPrivate(msg)) {
msg.channel.send(message);
return;
}
if (hasPerms(msg) && suffix === "post") {
bot.channels.get(ChannelID).send(message);
} else {
msg.channel.send(msg.author + " Release notes sent via DM");
msg.author.send(message);
} }
};
if (inPrivate(msg)) {
msg.channel.send(message);
return;
}
if (hasPerms(msg) && suffix === "post") {
bot.channels.get(ChannelID).send(message);
} else { } else {
msg.channel.send(msg.author + " Release notes sent via DM"); message = releasemessage.trim().split("###").filter(function(n) {
msg.author.send(message); return n !== "";
});
releasemessage1 = message[0];
releasemessage2 = message[1];
releasemessage3 = message[2];
releasemessage4 = message[3];
releasemessage5 = message[4];
message1 = {
embed: {
title: "*Download " + releasename + " here!*",
description: releasemessage1,
url: releaseurl,
color: 7976557,
timestamp: releasedate,
author: {
name: "Lbry-app Release Notes for " + releasename,
icon_url: "http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png"
},
footer: {
icon_url: "https://i.imgur.com/yWf5USu.png",
text: "Lbry-app Updated "
}
}
};
message2 = {
embed: {
description: releasemessage2,
color: 7976557,
timestamp: releasedate,
author: {
icon_url: "http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png"
},
footer: {
icon_url: "https://i.imgur.com/yWf5USu.png",
text: "Lbry-app Updated "
}
}
};
message3 = {
embed: {
description: releasemessage3,
color: 7976557,
timestamp: releasedate,
author: {
icon_url: "http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png"
},
footer: {
icon_url: "https://i.imgur.com/yWf5USu.png",
text: "Lbry-app Updated "
}
}
};
message4 = {
embed: {
description: releasemessage4,
color: 7976557,
timestamp: releasedate,
author: {
icon_url: "http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png"
},
footer: {
icon_url: "https://i.imgur.com/yWf5USu.png",
text: "Lbry-app Updated "
}
}
};
message5 = {
embed: {
description: releasemessage5,
color: 7976557,
timestamp: releasedate,
author: {
icon_url: "http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png"
},
footer: {
icon_url: "https://i.imgur.com/yWf5USu.png",
text: "Lbry-app Updated "
}
}
};
if (inPrivate(msg)) {
msg.channel.send(message1);
msg.channel.send(message2);
msg.channel.send(message3);
msg.channel.send(message4);
msg.channel.send(message5);
return;
}
if (hasPerms(msg) && suffix === "post") {
bot.channels.get(ChannelID).send(message1);
bot.channels.get(ChannelID).send(message2);
bot.channels.get(ChannelID).send(message3);
bot.channels.get(ChannelID).send(message4);
bot.channels.get(ChannelID).send(message5);
} else {
msg.channel.send(msg.author + " Release notes sent via DM");
msg.author.send(message1);
msg.author.send(message2);
msg.author.send(message3);
msg.author.send(message4);
msg.author.send(message5);
}
} }
}); });
} }

View file

@ -1,5 +1,6 @@
var config = require("config"); let config = require("config");
rolelist = config.get("rolelist"); let botconfig = config.get("bot");
let rolelist = config.get("rolelist");
exports.commands = [ exports.commands = [
"addrole", // command that is in this file, every command needs it own export as shown below "addrole", // command that is in this file, every command needs it own export as shown below
@ -21,28 +22,34 @@ exports.addrole = {
//console.log(rolelist); //console.log(rolelist);
//console.log(rolelist.allowedroles); //console.log(rolelist.allowedroles);
//console.log(config.get('allowedroles')); //console.log(config.get('allowedroles'));
if (rolelist.allowedroles.includes(suffix)) { if (suffix) {
//console.log('Role is in allowed roles.'); if (rolelist.allowedroles.includes(suffix)) {
//console.log('Role to add: ' + newrole); //console.log('Role is in allowed roles.');
if (!msg.member.roles.find("name", suffix)) { //console.log('Role to add: ' + newrole);
msg.member if (!msg.member.roles.find("name", suffix)) {
.addRole(newrole) msg.member
.then( .addRole(newrole)
.then(
msg.channel.send(
msg.member + " has been added to the " + suffix + " role!"
)
);
//console.log('Added role')
//msg.channel.send(msg.member + ' has been added to the ' + suffix + ' role!');
} else {
msg.channel.send(
"It seems that you already have that role! Try removing it first with the " + botconfig.prefix + "delrole command!"
);
}
} else {
msg.channel.send( msg.channel.send(
msg.member + " has been added to the " + suffix + " role!" "That role isn't one you can add yourself too! Please run the " + botconfig.prefix + "roles command to find out which ones are allowed."
) );
); }
//console.log('Added role')
//msg.channel.send(msg.member + ' has been added to the ' + suffix + ' role!');
} else {
msg.channel.send(
"It seems that you already have that role! Try removing it first with the delrole command!"
);
}
} else { } else {
msg.channel.send( msg.channel.send (
"That role isn't one you can add yourself too! Please run the roles command to find out which ones are allowed." "Please specify a role. Type " + botconfig.prefix + "roles to see which you may add!"
); )
} }
} }
}; };
@ -56,24 +63,30 @@ exports.delrole = {
//console.log('Delrole Event firing.'); //console.log('Delrole Event firing.');
//console.log(msg); //console.log(msg);
//console.log('Printing Suffix! ' + suffix); //console.log('Printing Suffix! ' + suffix);
if (rolelist.allowedroles.includes(suffix)) { if (suffix) {
if (msg.member.roles.find("name", suffix)) { if (rolelist.allowedroles.includes(suffix)) {
msg.member if (msg.member.roles.find("name", suffix)) {
.removeRole(oldrole) msg.member
.then( .removeRole(oldrole)
.then(
msg.channel.send(
msg.member + " has been removed from the " + suffix + " role!"
)
);
} else {
msg.channel.send(
"You don't seem to have that role! Try adding it first with the " + botconfig.prefix + "addrole command!"
);
}
} else {
msg.channel.send( msg.channel.send(
msg.member + " has been removed from the " + suffix + " role!" "That role isn't one you can add yourself too! Please run the " + botconfig.prefix + "roles command to find out which ones are allowed."
) );
); }
} else {
msg.channel.send(
"You don't seem to have that role! Try adding it first with the addrole command!"
);
}
} else { } else {
msg.channel.send( msg.channel.send(
"That role isn't one you can add yourself too! Please run the roles command to find out which ones are allowed." "Please specify a role. Type " + botconfig.prefix + "roles to see which you may add!"
); )
} }
} }
}; };

View file

@ -77,8 +77,8 @@
}, },
"rolelist": { "rolelist": {
"allowedroles": [ "allowedroles": [
"Role1", "Reward Scammer",
"Role2" "Reported Scammer"
] ]
}, },
"claimbot": { "claimbot": {