iansan5653 / discord-votemaster

Advanced polling bot for Discord.
MIT License
8 stars 8 forks source link

Fatal error thrown when required parameters are not passsed to commands #2

Open Scatter-Security opened 5 years ago

Scatter-Security commented 5 years ago

ISSUE: the command !results #0 or !vote #0 is failing to catch some bad input. Input by a user it throws a unexpected error and crashes the script when a user sends a command !results without the #

index.js:367
            } else if(args[0].charAt(0) !== '#') {
                              ^
TypeError: Cannot read property 'charAt' of undefined

and

events.js:180
    throw err; // Unhandled 'error' event
    ^

FIX: where if(args[0].charAt(0) !== '#') {

should be

if(!args[0] || args[0].charAt(0) !== '#') {

iansan5653 commented 5 years ago

Want to submit a PR for this?

iansan5653 commented 5 years ago

Actually, don't bother; I'm going to refactor the entire file anyway so this bug will be handled pretty soon

Scatter-Security commented 5 years ago

Ian, Good job on this bot. Other than the bug I specified it's really well written. Best, Justen

Get Outlook for Androidhttps://aka.ms/ghei36


From: Ian Sanders notifications@github.com Sent: Thursday, March 14, 2019 7:37:57 AM To: iansan5653/discord-votemaster Cc: Abstract; Author Subject: Re: [iansan5653/discord-votemaster] throws a unhandled error and crashes (#2)

Actually, don't bother; I'm going to refactor the entire file anyway so this bug will be handled pretty soon

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/iansan5653/discord-votemaster/issues/2#issuecomment-472890660, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AdpC0jIx_z9VP9HG1QUBM7pFimBemW78ks5vWl7FgaJpZM4bzXXB.

iansan5653 commented 5 years ago

Thanks! I plan to take it a lot further but I haven't been on Discord in ages.

Scatter-Security commented 5 years ago

I hope you don't mind if I fork this. and implement my own features to make a multi purpose bot.

I'd like to use this for my cybersecurity club's discord.

iansan5653 commented 5 years ago

Sure, but you may want to wait a little; I have some improvements I'll merge soon.