This repository has been archived by the owner on Jan 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update dependencies * Update eslint config Seems that some of the stuff I've set has been borked for awhile, tis' what I get for not reading about it properly. Anyways its fixed now. * Make bugsnag more useful & easier to use It's amazing what a bit of configuration can do. * Actually fix eslint We all make mistakes, maybe next time it wouldn't be me. * Fix the indenting * Fix access_checker (#44) * Fix eslint conf formatting * add feature to use previously used link (with "-") (#48) * add feature to use previously used link (with "-") * fix * !info command (#32) * !info command So I made a !info command which takes either Username#Discrim, a mention or even a discord ID and gives you info on that user on UV. It even lets you get their UV profile by Discord User ID if they arent on the server. Even better it shouldn't have syntax errors because I used Visual Studio now Even better I might add it showing stuff like the latest Upvote and Suggestion EEEEEven better you get to test it because I can't :^) * Format since @LW001 can't * Color thing changed Lol mobile code editing * Made the if larger More mobile editing please * ESLint Fix some things It was a christmas tree, still is a bit. * Fixed the method that's not a method to be no method https://youtu.be/nX7CeTXoxyU * Fix the foreach * Parts rewritten, added last upvoted and submitted * done teaman next * Bump for travis * shut travis up * Complete rewrite of !info Whew laddy. Works on staging now. * Revert "Merge branch 'develop' into patch-3" This reverts commit 246bc0f. * Style fix * nice typo @LW001 * Update package.json * Analytics database handler * Final commit for analytics collection * heheh * Don't allow submitting the same card 2 times * Make the data for info more readable. I actually tested to ensure it would convert and output correctly. * Change last submmited suggestion to last touched Need to reflect what it actually it is. * Experimental: Calculate consecutive days * Cache depends on travis * Properly count consecutive days * !info username#discrim fix (#52) * Stats command This only returns your own stats, an admin version to return the stats of someone else is coming later. * lookup command This is for admins to lookup someone elses stats * Version bump * Log error body instead * Make date even more proper using moment got to make everything pretty,
- Loading branch information
Showing
9 changed files
with
1,225 additions
and
18 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ language: node_js | |
node_js: | ||
- "7" | ||
|
||
install: | ||
- npm install | ||
cache: npm install | ||
|
||
script: | ||
- npm run lint |
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
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
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,37 @@ | ||
const Dash = require('rethinkdbdash') | ||
const r = new Dash() | ||
|
||
module.exports = { | ||
awardPoints: (user, type) => { | ||
return new Promise((resolve, reject) => { | ||
let now = new Date() | ||
let today = new Date(now.getFullYear(), now.getUTCMonth(), now.getUTCDate()).getTime() | ||
let consecutive | ||
r.db('DFB').table('analytics').get(user).then(o => { | ||
if (o === null) return r.db('DFB').table('analytics').insert({ | ||
id: user, | ||
consecutive: [] | ||
}) | ||
consecutive = o.consecutive !== undefined ? o.consecutive : [today.toString()] | ||
if (consecutive.indexOf(today.toString()) === -1) { | ||
let last = new Date(parseInt(consecutive[consecutive.length -1])) | ||
let difference = today - last | ||
if (difference === 86400000) { // 1 day difference | ||
consecutive.push(today.toString()) | ||
} else { | ||
consecutive = [today.toString()] | ||
} | ||
} | ||
r.db('DFB').table('analytics').get(user).update({ | ||
[type]: { [today]: r.row(type)(today.toString()).default(0).add(1) }, | ||
consecutive: consecutive | ||
}).run().then(resolve).catch(reject) | ||
}) | ||
}) | ||
}, | ||
getPoints: (user) => { | ||
return new Promise((resolve, reject) => { | ||
r.db('DFB').table('analytics').get(user).run().then(resolve).catch(reject) | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.