mirror of
https://github.com/LBRYFoundation/lbry-wunderbot.git
synced 2025-08-23 17:47:27 +00:00
formatted code
This commit is contained in:
parent
67b12a1e46
commit
d31f839039
5 changed files with 100 additions and 83 deletions
|
@ -1,10 +1,10 @@
|
||||||
let config = require("config");
|
let config = require('config');
|
||||||
let permRanks = config.get("moderation");
|
let permRanks = config.get('moderation');
|
||||||
let speechBotChannels = config.get("speechbot");
|
let speechBotChannels = config.get('speechbot');
|
||||||
let priceBotChannels = config.get("pricebot");
|
let priceBotChannels = config.get('pricebot');
|
||||||
let ExcludedSpam = config.get("spamdetection");
|
let ExcludedSpam = config.get('spamdetection');
|
||||||
let hashBotChannels = config.get("hashbot");
|
let hashBotChannels = config.get('hashbot');
|
||||||
let statsBotChannels = config.get("statsbot");
|
let statsBotChannels = config.get('statsbot');
|
||||||
|
|
||||||
// Checks if user is allowed to use a command only for mods/team members
|
// Checks if user is allowed to use a command only for mods/team members
|
||||||
exports.hasPerms = function(msg) {
|
exports.hasPerms = function(msg) {
|
||||||
|
@ -13,7 +13,7 @@ exports.hasPerms = function(msg) {
|
||||||
|
|
||||||
// Check if command was sent in dm
|
// Check if command was sent in dm
|
||||||
exports.inPrivate = function(msg) {
|
exports.inPrivate = function(msg) {
|
||||||
return msg.channel.type == "dm";
|
return msg.channel.type == 'dm';
|
||||||
};
|
};
|
||||||
|
|
||||||
// Checks if Message was sent from a channel in speechBot Channels list
|
// Checks if Message was sent from a channel in speechBot Channels list
|
||||||
|
|
|
@ -39,7 +39,8 @@ exports.releasenotes = {
|
||||||
timestamp: releasedate,
|
timestamp: releasedate,
|
||||||
author: {
|
author: {
|
||||||
name: "Lbry-app Release Notes for " + releasename,
|
name: "Lbry-app Release Notes for " + releasename,
|
||||||
icon_url: "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",
|
||||||
|
@ -58,7 +59,10 @@ exports.releasenotes = {
|
||||||
msg.author.send(message);
|
msg.author.send(message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message = releasemessage.trim().split("###").filter(function(n) {
|
message = releasemessage
|
||||||
|
.trim()
|
||||||
|
.split("###")
|
||||||
|
.filter(function(n) {
|
||||||
return n !== "";
|
return n !== "";
|
||||||
});
|
});
|
||||||
releasemessage1 = message[0];
|
releasemessage1 = message[0];
|
||||||
|
@ -75,7 +79,8 @@ exports.releasenotes = {
|
||||||
timestamp: releasedate,
|
timestamp: releasedate,
|
||||||
author: {
|
author: {
|
||||||
name: "Lbry-app Release Notes for " + releasename,
|
name: "Lbry-app Release Notes for " + releasename,
|
||||||
icon_url: "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",
|
||||||
|
@ -89,7 +94,8 @@ exports.releasenotes = {
|
||||||
color: 7976557,
|
color: 7976557,
|
||||||
timestamp: releasedate,
|
timestamp: releasedate,
|
||||||
author: {
|
author: {
|
||||||
icon_url: "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",
|
||||||
|
@ -103,7 +109,8 @@ exports.releasenotes = {
|
||||||
color: 7976557,
|
color: 7976557,
|
||||||
timestamp: releasedate,
|
timestamp: releasedate,
|
||||||
author: {
|
author: {
|
||||||
icon_url: "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",
|
||||||
|
@ -117,7 +124,8 @@ exports.releasenotes = {
|
||||||
color: 7976557,
|
color: 7976557,
|
||||||
timestamp: releasedate,
|
timestamp: releasedate,
|
||||||
author: {
|
author: {
|
||||||
icon_url: "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",
|
||||||
|
@ -131,7 +139,8 @@ exports.releasenotes = {
|
||||||
color: 7976557,
|
color: 7976557,
|
||||||
timestamp: releasedate,
|
timestamp: releasedate,
|
||||||
author: {
|
author: {
|
||||||
icon_url: "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",
|
||||||
|
|
|
@ -38,18 +38,24 @@ exports.addrole = {
|
||||||
//msg.channel.send(msg.member + ' has been added to the ' + suffix + ' role!');
|
//msg.channel.send(msg.member + ' has been added to the ' + suffix + ' role!');
|
||||||
} else {
|
} else {
|
||||||
msg.channel.send(
|
msg.channel.send(
|
||||||
"It seems that you already have that role! Try removing it first with the " + botconfig.prefix + "delrole command!"
|
"It seems that you already have that role! Try removing it first with the " +
|
||||||
|
botconfig.prefix +
|
||||||
|
"delrole command!"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg.channel.send(
|
msg.channel.send(
|
||||||
"That role isn't one you can add yourself too! Please run the " + botconfig.prefix + "roles command to find out which ones are allowed."
|
"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 {
|
} else {
|
||||||
msg.channel.send(
|
msg.channel.send(
|
||||||
"Please specify a role. Type " + botconfig.prefix + "roles to see which you may add!"
|
"Please specify a role. Type " +
|
||||||
)
|
botconfig.prefix +
|
||||||
|
"roles to see which you may add!"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -75,18 +81,24 @@ exports.delrole = {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
msg.channel.send(
|
msg.channel.send(
|
||||||
"You don't seem to have that role! Try adding it first with the " + botconfig.prefix + "addrole command!"
|
"You don't seem to have that role! Try adding it first with the " +
|
||||||
|
botconfig.prefix +
|
||||||
|
"addrole command!"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg.channel.send(
|
msg.channel.send(
|
||||||
"That role isn't one you can add yourself too! Please run the " + botconfig.prefix + "roles command to find out which ones are allowed."
|
"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 {
|
} else {
|
||||||
msg.channel.send(
|
msg.channel.send(
|
||||||
"Please specify a role. Type " + botconfig.prefix + "roles to see which you may add!"
|
"Please specify a role. Type " +
|
||||||
)
|
botconfig.prefix +
|
||||||
|
"roles to see which you may add!"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
const fs = require("fs"),
|
const fs = require('fs'),
|
||||||
path = require("path");
|
path = require('path');
|
||||||
|
|
||||||
function getPlugins(srcpath) {
|
function getPlugins(srcpath) {
|
||||||
return fs.readdirSync(srcpath);
|
return fs.readdirSync(srcpath);
|
||||||
}
|
}
|
||||||
let plugin_directory = path.join(__dirname, "modules");
|
let plugin_directory = path.join(__dirname, 'modules');
|
||||||
let plugins = getPlugins(plugin_directory);
|
let plugins = getPlugins(plugin_directory);
|
||||||
|
|
||||||
exports.init = function init() {
|
exports.init = function init() {
|
||||||
|
@ -14,7 +14,7 @@ exports.init = function init() {
|
||||||
};
|
};
|
||||||
|
|
||||||
function load_plugins() {
|
function load_plugins() {
|
||||||
const dbot = require("./bot.js");
|
const dbot = require('./bot.js');
|
||||||
let commandCount = 0;
|
let commandCount = 0;
|
||||||
let otherFunc = 0;
|
let otherFunc = 0;
|
||||||
for (let i = 0; i < plugins.length; i++) {
|
for (let i = 0; i < plugins.length; i++) {
|
||||||
|
@ -25,7 +25,7 @@ function load_plugins() {
|
||||||
console.log(`Improper setup of the '${plugins[i]}' plugin. : ${err}`);
|
console.log(`Improper setup of the '${plugins[i]}' plugin. : ${err}`);
|
||||||
}
|
}
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
if ("commands" in plugin) {
|
if ('commands' in plugin) {
|
||||||
for (let j = 0; j < plugin.commands.length; j++) {
|
for (let j = 0; j < plugin.commands.length; j++) {
|
||||||
if (plugin.commands[j] in plugin) {
|
if (plugin.commands[j] in plugin) {
|
||||||
dbot.addCommand(plugin.commands[j], plugin[plugin.commands[j]]);
|
dbot.addCommand(plugin.commands[j], plugin[plugin.commands[j]]);
|
||||||
|
@ -33,7 +33,7 @@ function load_plugins() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("custom" in plugin) {
|
if ('custom' in plugin) {
|
||||||
for (let j = 0; j < plugin.custom.length; j++) {
|
for (let j = 0; j < plugin.custom.length; j++) {
|
||||||
if (plugin.custom[j] in plugin) {
|
if (plugin.custom[j] in plugin) {
|
||||||
dbot.addCustomFunc(plugin[plugin.custom[j]]);
|
dbot.addCustomFunc(plugin[plugin.custom[j]]);
|
||||||
|
@ -43,9 +43,5 @@ function load_plugins() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(
|
console.log(`Loaded ${dbot.commandCount()} chat commands and ${otherFunc} custom functions.`);
|
||||||
`Loaded ${dbot.commandCount()} chat commands and ${
|
|
||||||
otherFunc
|
|
||||||
} custom functions.`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue