From df8258ea7526d5911243f159b3a5183c6ee382cb Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 13 Dec 2017 02:01:35 +0100 Subject: [PATCH] cleaned up commands made is to that they get triggered even inbetween the messages UNTESTED and not fully configured yet --- bot/modules/commandsV2.js | 31 ++++++++++++++++ config/commands.json | 78 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 bot/modules/commandsV2.js create mode 100644 config/commands.json diff --git a/bot/modules/commandsV2.js b/bot/modules/commandsV2.js new file mode 100644 index 0000000..9d05704 --- /dev/null +++ b/bot/modules/commandsV2.js @@ -0,0 +1,31 @@ +'use strict'; +let commands = require("../../config/commands"); +const Discord = require("discord.js"); +let initialized = false; + +module.exports = { + init: init +}; + +function init(discordBot_) { + if (initialized) { + throw new Error("init was already called once"); + } + + discordBot = discordBot_; + + discordBot.on("message", checkForCommand); +} + + +/** + * + * @param {String} message + */ +let checkForCommand = function (message) { + Object.keys(commands).forEach(command => { + if (message.indexOf(command) && commands[command].operation === 'send') { + msg.channel.send(commands[command].bundle); + } + }); +} \ No newline at end of file diff --git a/config/commands.json b/config/commands.json new file mode 100644 index 0000000..395086e --- /dev/null +++ b/config/commands.json @@ -0,0 +1,78 @@ +{ + "!helpcommands": { + "usage": "", + "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", + "operation": "send", + "bundle": { + "url": "", + "title": "", + "message": "**!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**", + "color": 7976557, + "author": { + "name": "List of Helpful LBRY Commands", + "url": "", + "icon_url": "https://i.imgur.com/yWf5USu.png" + } + } + }, + "!what": { + "usage": "", + "description": "What is Lbry?", + "operation": "send", + "bundle": { + "url": "https://lbry.io/what", + "title": "*Click Here for more Info!*", + "message": "[**LBRY**](https://lbry.io) is a protocol providing fully decentralized network for the discovery, distribution, and payment of data. It utilizes the [**LBRY blockchain**](https://lbry.io/what#the-network) as a global namespace and database of digital content. Blockchain entries contain searchable content metadata, identities, and rights and access rules. \n[_**Get the App here**_](https://lbry.io/get)", + "color": 7976557, + "author": { + "name": "What is LBRY?", + "url": "https://lbry.io/what", + "icon_url": "https://i.imgur.com/yWf5USu.png" + } + } + }, + "!begging": { + "usage": "", + "description": "Dont Request Free Coins Message", + "operation": "send", + "bundle": { + "url": "", + "title": "", + "message": "**Please don't request free coins or invites, we have a strict policy against begging. Further offenses will result in removal from the chat.**", + "color": 7976557, + "author": { + "name": "BEGGING!", + "url": "https://i.imgur.com/yWf5USu.png", + "icon_url": "" + } + } + }, + "!beta": {}, + "!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": {} +} \ No newline at end of file