This repository has been archived by the owner on Oct 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from TobiasFeld22/Tobias-updates
Update check
- Loading branch information
Showing
11 changed files
with
381 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# ========================= | ||
# Operating System Files | ||
# ========================= | ||
|
||
# OSX | ||
# ========================= | ||
|
||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Windows | ||
# ========================= | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# custom. | ||
config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## Contributing to EDB | ||
|
||
We want to make it easy for you to help with developing, we just want to make sure of a few things. | ||
|
||
1. All code is examined using eslint (npm install eslint && eslint .), using our configuration file included inside of the repository. | ||
2. Malicious code is not allowed, deliberately adding bugs or causing (parts of) the framework to chrash. | ||
3. All code submitted must be "beautified" before posting, if you want to keep it simple, just use [this one](https://jsbeautifier.org) | ||
|
||
## Submitting a new issue | ||
|
||
Before submitting a new issue: | ||
|
||
- Search the issues to see if your issue hasn't been added before, (and if it has a fix already.) | ||
- No issues about external modules used for commands etc. we will only look at the issue if the cause of the issue lies within the frameworks code | ||
Contact the developer that made the module for more information. | ||
- No issues asking us for help on how to set up a bot, You can find info about how to set a bot up on our website. If the website is not clear enough, | ||
create an issue and tell us what should be made easier to understand for other users. | ||
- Don't add "me 2" or something like that in the commands. You can react with :thumbsup: on the initial issue to show us. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var command = module.exports = {} | ||
var path = require("path") | ||
var fs = require("fs") | ||
command.name = "createcommand" | ||
|
||
command.command = function(client, message) { | ||
var args = message.content.split(" "); | ||
if (!message.author.id == client.config.owner_id) { | ||
return | ||
} | ||
if (args[1] == null) { | ||
return message.channel.send("[EDB] Please specify the name for the command. If you want to use aliases, type them space-seperated behind the name."); | ||
|
||
} | ||
|
||
var data = { | ||
aliases: [], | ||
name: args[1] | ||
} | ||
if (args[1].match(/[/\\<>:*|]/g)){ | ||
return message.channel.send("[EDB] Filenames can't include one of these characters: ` / \\ < > : * | `, please try a different filename.") | ||
} | ||
if (args[2] != null) { | ||
args.forEach((i, index) => { | ||
if (index > 1) { | ||
data.aliases.push(i) | ||
} | ||
}) | ||
} | ||
fs.access(path.resolve(path.dirname(require.main.filename), "commands/" + data.name + ".js"), fs.constants.R_OK, (err) => { | ||
if (!err) { | ||
return message.channel.send("[EDB] This file does already exist. Please try a different name. ") | ||
} | ||
|
||
fs.writeFile(path.resolve(path.dirname(require.main.filename), "commands/" + data.name + ".js"), "exports.name = \"" + data.name + "\" \nexports.aliases = " + JSON.stringify(data.aliases) + "\nexports.command = function(client, message){\n\n//Write your command functions here.\n\n} ", {options: "utf8"}, (err) => { | ||
if (err) { | ||
return message.channel.send("[EDB] Failed to create this file, try to create it manually using this template: ```javascript\nexports.name = \"" + data.name + "\" \nexports.aliases = \"" + JSON.stringify(data.aliases) + "\"\nexports.command = function(client, message){\n\n//Write your command functions here.\n\n} \n```") | ||
} | ||
return message.channel.send("[EDB] Created `commands/" + data.name + ".js`, with **" + data.aliases.length + "** aliases. \nPut some code into this file to make it do something.") | ||
|
||
}) | ||
|
||
|
||
|
||
|
||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const request = require("request"); | ||
module.exports = function(edb) { | ||
return new Promise(function(resolve, reject) { | ||
request("https://easy-discord-bot.tk/update?currentversion=" + edb.version, | ||
function(error, response, body) { | ||
if (error) { | ||
return reject("Sorry, There was a issue whilst checking for a update, try again later.") | ||
} else if (response.statusCode == 200) { | ||
var data = JSON.parse(body) | ||
if (data.update_required) { | ||
var version = null; | ||
if (edb.version.includes("beta")) { | ||
version = data.latest_beta | ||
} else { | ||
version = data.latest | ||
} | ||
|
||
return resolve("\nAn update is required, please type npm install easy-discord-bot \nto install the latest version ( v" + edb.version + " --> v" + version + ")") | ||
} | ||
} | ||
|
||
|
||
}) | ||
}); | ||
} |
Oops, something went wrong.