Skip to content

Commit

Permalink
Minor Improvements (#3)
Browse files Browse the repository at this point in the history
* Capitalize Discord

* Simplify repository data

* Use path.join

* Fix JSDoc comments
  • Loading branch information
jonahsnider authored and maybeanerd committed Aug 8, 2018
1 parent 66858f6 commit cd33bb0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at T0TProduction#0001 on discord. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at T0TProduction#0001 on Discord. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
33 changes: 20 additions & 13 deletions blapi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const bttps = require(__dirname + '/bttps.js');
const { join } = require('path');
const bttps = require(join(__dirname, 'bttps.js'));

async function handleInternal(discordClient, apiKeys, repeatInterval) {
//set the function to repeat
Expand All @@ -9,7 +10,9 @@ async function handleInternal(discordClient, apiKeys, repeatInterval) {
if (repeatInterval > 2) { //if the interval isnt below Metalists ratelimit, use their API
apiKeys["server_count"] = discordClient.guilds.size;
apiKeys["bot_id"] = discordClient.user.id;
bttps.post('themetalist.org', '/api/count', 'no key needed for this', apiKeys).catch((e) => console.log(e));
bttps
.post('themetalist.org', '/api/count', 'no key needed for this', apiKeys)
.catch((e) => console.log(e));
} else {
postToAllLists(discordClient.guilds.size, discordClient.user.id, apiKeys);
}
Expand All @@ -19,26 +22,30 @@ async function handleInternal(discordClient, apiKeys, repeatInterval) {
}

module.exports = {
/* discordClient: the client via wich your code is connected to discord
* apiKeys: a JSON object formatted like: {"botlist name":"API Keys for that list", etc.} ;
* repeatInterval: integer value of minutes until you want to post again
* This function is for automated use with discord.js */
/**
* This function is for automated use with discord.js
* @param {Client} discordCLient Client via wich your code is connected to Discord
* @param {object} apiKeys A JSON object formatted like: {"botlist name":"API Keys for that list", etc.}
* @param {integer} repeatInterval Number of minutes until you want to post again
*/
handle: async (discordClient, apiKeys, repeatInterval) => {
//handle inputs
if (!repeatInterval || repeatInterval < 1)
repeatInterval = 30;
handleInternal(discordClient, apiKeys, repeatInterval);
},
/* guildCount: integer value of guilds your bot is serving
* botID: snowflake of the ID the user your bot is using
* apiKeys: a JSON object formatted like: {"botlist name":"API Keys for that list", etc.} ;
* noMetaListPlis: you don't want to use MetaLists API for some reason, so you don't need to
* This function is for when you don't use discord.js or just want to post to manual times */
/**
* For when you don't use discord.js or just want to post to manual times
* @param {integer} guildCount Integer value of guilds your bot is serving
* @param {string} botID Snowflake of the ID the user your bot is using
* @param {object} apiKeys A JSON object formatted like: {"botlist name":"API Keys for that list", etc.}
* @param {boolean} noMetaListPlis You don't want to use MetaLists API for some reason, so you don't need to
*/
manualPost: async (guildCount, botID, apiKeys, noMetaListPlis) => {
if (!noMetaListPlis) {
apiKeys["server_count"] = guildCount;
apiKeys["bot_id"] = botID;
bttps.post('themetalist.org', '/api/count', 'no key needed for this', apiKeys).catch((e) => console.log(e));
bttps.post('themetalist.org', '/api/count', 'no key needed for this', apiKeys).catch((e) => console.error(e));
} else {
postToAllLists(guildCount, botID, apiKeys);
}
Expand Down Expand Up @@ -148,4 +155,4 @@ const oldListData = {
"api_post": null,
"api_field": null
}
}
}
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{
"name": "blapi",
"version": "0.2.5",
"version": "0.2.7",
"description": "BLAPI is a package to handle posting your discord stats to botlists. It's intended to be used with discord.js, though you can also manually post your stats.",
"main": "blapi.js",
"repository": {
"type": "git",
"url": "git+https://github.com/T0TProduction/BLAPI.git"
},
"repository": "T0TProduction/BLAPI",
"keywords": [
"discord",
"js",
Expand Down

0 comments on commit cd33bb0

Please sign in to comment.