discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.39k stars 3.97k forks source link

I have an issue (not a bug, just need some help) #1235

Closed marisklava closed 7 years ago

marisklava commented 7 years ago

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 {

constructor(client) {
    super(client, {

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.

devsnek commented 7 years ago

https://github.com/gawdl3y/discord.js-commando