Good coding practices
Don't install unnecessary libraries. Your bot might be slow after that.
You can organize your commands in folders.

// Before all command - @
// set your ADMIN_ID here
// you can get it via Bot.sendMessage(user.id)
var isAdmin = ( user && (user.id == ADMIN_ID) )
if(!command){
return
}
if((command.folder=="Admin Panel")&&(isAdmin){
// only admin can run command from Admin Panel's folder
// any common bjs here for admin
Bot.sendMessage("Hello, admin!")
}else{
Bot.sendMessage("Access denied");
return // exit from command now
}
// other example
if(command.folder=="Under development"){
Bot.sendMessage("Sorry this command on development")
}
Do you have children.
Two boys and one girl. You do not call them b1, b2 ang g1, are you not ?
So why do you call your variables like that?
Bad examples:
- x1
- y2
- d3
Good:
- currentLimit
- maxCount
- userName

Bad code:

Good code:

Bad code:

Each getProperty method spent above 10-100 ms for execution. So if you have 10 getProperty methods bot can spent above 1 sec for execution! It is slowly
Use JSON type:

Do not repeat youself!
Bad code:


Good code:


Last modified 1yr ago