iansan5653 / discord-votemaster Goto Github PK
View Code? Open in Web Editor NEWAdvanced polling bot for Discord.
License: MIT License
Advanced polling bot for Discord.
License: MIT License
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) !== '#') {
Hi, I noticed you had strikethrough text describing a feature to list the users that voted. Is this feature something planned and not yet made? Or a feature that was made and Discord changed their permissions to no longer make this possible?
Hey Ian,
found another one just for your information.
when user inputs a command!vote #0
without the following args[1]
will result in another fatal crash.
so I included || !args[1]
to the if statement to catch.
look forward to see your latest edition. Eventually I will add some more features and fork this baby and ensure credit is due for the wonderful poll system you coded.
best,
Just
ISSUE:
if(activePollsInServer.length === 0) {
voteResponse = `There aren't any active polls in this server right now, so you can't vote.`;
- } else if(!args[0] || args[0].charAt(0) !== '#') {
// Only the vote was supplied
if(activePollsInServer.length === 1) {
voteResponse = polls.get(activePollsInServer[0]).vote(args[0].toLowerCase(), message.author).message;
} else {
// TODO dynamic examples
voteResponse = 'Sorry, I don\'t know which poll to vote on. Please specify the poll id number using a pound sign and a number (ie \'!vote #1 A\') before your vote.';
}
FIXED:
if(activePollsInServer.length === 0) {
voteResponse = `There aren't any active polls in this server right now, so you can't vote.`;
} else if(!args[0] || args[0].charAt(0) !== '#' || !args[1]) {
// Only the vote was supplied
if(activePollsInServer.length === 1) {
voteResponse = polls.get(activePollsInServer[0]).vote(args[0].toLowerCase(), message.author).message;
} else {
// TODO dynamic examples
voteResponse = 'Sorry, I don\'t know which poll to vote on. Please specify the poll id number using a pound sign and a number (ie \'!vote #1 A\') before your vote.';
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.