Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 400 undefined #73

Open
istiaqueahmedarik opened this issue Aug 22, 2021 · 2 comments
Open

Error: 400 undefined #73

istiaqueahmedarik opened this issue Aug 22, 2021 · 2 comments

Comments

@istiaqueahmedarik
Copy link

I test it on a NextJS project. and I got this every time when I want to use message builder.

Unhandled Runtime Error
Error: 400 undefined

Source
.next\static\chunks\pages\test.js (195:0) @ <unknown>

  193 |   return res;
  194 | } else {
> 195 |   const err = new Error(`${res.status} ${res.statusText}`.trim());
  196 |   Object.assign(err, res);
  197 |   return Promise.reject(err);
  198 | }
@man15h
Copy link

man15h commented Nov 4, 2021

@istiaqueahmedarik this should work

const msg = new webhook.MessageBuilder()
        .setName('Awesome Bot')
        .setTitle('Awesome title')
        .setColor('#f1e05a')
        .setText(`Awesome text`)
        .setURL(`https://google.com`);
Hook.send(msg);

@Cerlancism
Copy link

Looks like now must put an embed with a Title. The example at Readme no longer works too:

const msg = new webhook.MessageBuilder()
                .setName("Username")
                .setColor("#aabbcc")
                .setText("This is my webhook!");
Hook.send(msg);

$ node --trace-warnings index.js
This now throws

(node:247015) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
    at /home/user/Documents/discord-test/node_modules/snekfetch/src/index.js:195:23
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
(node:247015) Error: 400 Bad Request
    at /home/user/Documents/discord-test/node_modules/snekfetch/src/index.js:195:23
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(node:247015) [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.
    at emitDeprecationWarning (internal/process/promises.js:180:11)
    at processPromiseRejections (internal/process/promises.js:249:13)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants