maxrumsey / hookcord Goto Github PK
View Code? Open in Web Editor NEWA user-friendly, sleek and fast client used to create and send Discord Webhooks.
Home Page: https://maxrumsey.xyz/hookcord/
License: MIT License
A user-friendly, sleek and fast client used to create and send Discord Webhooks.
Home Page: https://maxrumsey.xyz/hookcord/
License: MIT License
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)
Hello!
How would I go about sending a file via webhooks? I have tried supplying a URL to the payload
object (eg payload.file = https://some.doma.in/file.txt) and it didn't work. Any ideas? Any answer is appreciated.
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)})
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?
Snekfetch has been deprecated. The author of Snekfetch recommends we use node-fetch
instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.