javascript - UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeEr ror: Cannot read property 'map' of null -


so i'm creating bot using discord.js-commando. everything's working fine until try , sendembed, error

(node:25390) unhandledpromiserejectionwarning: unhandled promise rejection (rejection id: 2): typeer ror: cannot read property 'map' of null (node:25390) deprecationwarning: unhandled promise rejections deprecated. in future, promise  rejections not handled terminate node.js process non-zero exit code. 

i tried add .then , .catch, no luck far. because have no clue how make promises work. >_>

i use following code bot i'm working on seems getting issue.

const commando = require("discord.js-commando"); const modulestuff = module  class test extends commando.command { constructor(client) {     super(client, {         name: 'test',         aliases: ['testing'],         group: 'random',         membername: 'test',         description: 'testing',         examples: [ 'test' ]     }); }  async run(message, args) {     let promise = new promise(function(resolve, reject) {         resolve(1);     });     var bot = new commando.client();     promise.then(message.channel.sendembed({         color: 3447003,         author: {             name: bot.user.username,             icon_url: bot.user.avatarurl,         },         title: 'testing101',         url: 'http://discord.gg/smv3ncp',         description: 'this test command see if thing works.',         fields: [{             name: 'fields',             value: 'title test',         },         {             name: 'masked links',             value: 'let me see if can embed link this. [masked links](https://discord.gg/smv3ncp)',         },         {             name: 'markdown',             value: '*testing* __101__ _101_ **__101__**'         }         ],         timestamp: new date(),         footer: {             icon_url: bot.user.avatarurl,             text: 'requested ' + message.author,     }})).catch((error) => {         console.log('something went wrong!!');         done();     }).then(function() {         promise.then(message.channel.sendembed({         color: 3447003,         author: {             name: bot.user.username,             icon_url: bot.user.avatarurl,         },         title: 'testing101',         url: 'http://discord.gg/smv3ncp',         description: 'this test command see if thing works.',         fields: [{             name: 'fields',             value: 'title test',         },         {             name: 'masked links',             value: 'let me see if can embed link this. [masked links](https://discord.gg/smv3ncp)',         },         {             name: 'markdown',             value: '*testing* __101__ _101_ **__101__**'         }         ],         timestamp: new date(),         footer: {             icon_url: bot.user.avatarurl,             text: 'requested ' + message.author,         }}));           }) }};  module.exports = test;  

any appreciated.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -