Code Monkey home page Code Monkey logo

hookcord's People

Contributors

greenkeeper[bot] avatar maxrumsey avatar true-zero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

patwat67 twlite

hookcord's Issues

Hookcard has unhandled promise

We have found at a long term run often this warning in our log.

(node:17200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:17200) UnhandledPromiseRejectionWarning: Error: Ratelimit Reached.
at Object.handleRatelimit (/home/scidev2/Bots/hltv-scorebot/node_modules/hookcord/src/util.js:9:11)
at Base.send (/home/scidev2/Bots/hltv-scorebot/node_modules/hookcord/src/base.js:110:26)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:17200) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

Error 400 Bad Request

I decided to try to use the module for a different purpose seeing as the _statcode issue was fixed. Unfortunately, now I cannot seem to have it send the webhook and keep getting a 400 Bad Request error. I'm suspecting it's with what I'm trying to send on the discord webhook. I am building an embed (not a rich embed. Just an object embed) and it starts in a string. I've attempted to build at and parse. Unfortunately it does not appear to work if I leave my embed as either a string or parse it.

Here is the segment of code I'm working with if it helps at all.
let embedStart = '{embeds: [{color: 3447003,title: "Officer Quota Update",description: "Officer Quota Update on '+new Date()+'",fields: [' db.get("SELECT mainQuota FROM systemdata", (err, quotaRow) => { db.all("SELECT userid, name, quota FROM users WHERE quota!='x' ORDER BY quota DESC", function(err, rows) { //LIMIT 6,11 //TODO: pages rows.forEach(function (row) { db.all('SELECT points, date FROM events WHERE points!="0" AND host="'+row.userid+'" AND date>"'+quotaRow.mainQuota+'" ORDER BY name DESC', function(err, rows2) { let completedQuota = 0 let quotaStatus = "Null" rows2.forEach(function (row2) { completedQuota += Number(row2.points) }); if (completedQuota >= Number(row.quota)) { quotaStatus = "Complete" } else { quotaStatus = "Incomplete" } if(row != rows.slice(-1)[0]) { embedStart = embedStart + '{name: "'+row.name+'", value: "'+String(completedQuota)+'/'+String(row.quota)+' - '+quotaStatus+'"},' } if(row == rows.slice(-1)[0]) { embedStart = embedStart + '{name: "'+row.name+'", value: "'+String(completedQuota)+'/'+String(row.quota)+' - '+quotaStatus+'"' embedStart = embedStart + '}],timestamp: "'+new Date()+'",footer: {text: "© Conmmander 2019"}}]}' var Hook = new hookcord.Hook() .login('610148982781378560', 'iTjy7syi-Lin0pIxo8F1gLJhyN4BR_joEiJcosjhzOB3Z3dm34hGwYzUGIFx9ow4ztdv') .setPayload(embedStart) .fire() .then(function(response) {}) .catch(function(e) {console.log(e)})

No matter what I send through to the webhook, I still get:
image

Cannot read property '_statcode' of undefined

I decided to use this, and received an error.

"(node:19916) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '_statcode' of undefined
at Hook.fire (C:\Users...\Desktop\dudes bot\node_modules\hookcord\src\hook.js:71:21)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:19916) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:19916) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code."

What is going on here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.