I am still fairly new to javascript and it's basics, but i still wanted to try my hand at building a discord bot, when i tried to make a simple ban command i ran into an issue.
See, every time i try to run it i run into some errors like these:
(node:1104) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: B ad Request (node:1104) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise r ejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:1104) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeErro r: Cannot read property 'username' of undefined
I am still fairly new to javascript and it's basics, but i still wanted to try my hand at building a discord bot, when i tried to make a simple ban command i ran into an issue. See, every time i try to run it i run into some errors like these:
(node:1104) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: B ad Request (node:1104) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise r ejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:1104) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeErro r: Cannot read property 'username' of undefined
This is my code:
const discord = require('discord.js'); const commando = require('discord.js-commando'); class BanCommand extends commando.Command {
name: 'ban', group: 'random', memberName: 'ban', description: 'bans a user',
args: [ { key: 'member', label: 'member', prompt: 'What user would you like to ban?', type: 'member' } ] }); } async run(message, args) { msg.channel.permissionsFor(client.member).isOwner(user); msg.channel.guild.banMember(member.id, deleteDays); } } module.exports = BanCommand;
thx for helping, i know this is dumb, but please help anyways, since i am a noob.