cheesits456 / discord-ssh-bot

A node.js Discord bot for using shell commands remotely through Discord
GNU General Public License v3.0
35 stars 9 forks source link

Throws error on running #7

Closed Gamerz261 closed 3 years ago

Gamerz261 commented 4 years ago

Whenever you use the command specified in the readme (node index.js) the application throws the following error:

2020-10-31

cheesits456 commented 4 years ago

this might be related to discord's recent API changes, i'll look into this tonight and try to get it functional again

Gamerz261 commented 4 years ago

Sorry I only just saw this, apparently GitHub doesn't like sending notifications anymore, but thank you for looking into this issue, please let me know if you fix it :D

cheesits456 commented 4 years ago

Would you be able to provide more information about your system and configuration? I've tried multiple configurations across different platcroms and all have worked perfectly fine, i can't seem to be able to rproduce this error

Gamerz261 commented 4 years ago

Yes, I'm running this program on an old Linux Ubuntu system with an intel dual core (ik... I said it was old lmao)

cheesits456 commented 4 years ago

what version of nodejs are you running, and could you provide the contents of your config.json file, with the token censored out of course

Gamerz261 commented 3 years ago

sorry for not seeing this but in the config, I'm running { "channel": "772217287226294302", "owner": "", "token": "" } and I'm running on NodeJS 14.0 edit: I also tried running on the most recent and it produced the same error

cheesits456 commented 3 years ago

Sorry for such a delayed response - I'm still unable to reproduce your issue, so there's not much I can do to try to find the cause. I'm not sure why this issue occurred for you

Gamerz261 commented 3 years ago

Ok, I'll try some stuff on my end to see if I can reproduce the problem. Just out of curiosity, what is your suggested memory size (for when I run the command) I'm using -1024 which should be more than enough.

Gamerz261 commented 3 years ago

Also in the config, the owner i wasn't sure exactly what to put there

cheesits456 commented 3 years ago

Ahhhhh okay yeah that's probably the source of the error - for the owner key in config.json, you need to put your Discord user ID

Gamerz261 commented 3 years ago

Ok I'll check later today

Gamerz261 commented 3 years ago

sorry for coming back to this so late, but I have realized the OS flag in packages.json should probably be changed because I am running this bot on Ubuntu Linux

cheesits456 commented 3 years ago

!win32 means any OS aside from win32 - ! means not

mrc4tt commented 3 years ago

Hey.

I have same issues when starting the index.js :) any fix planned?

cheesits456 commented 3 years ago

Found the source of the problem - the bot was trying to grab the owner's user object by using client.users.cache.get(id), but with Discord's relatively recent API changes, user objects don't get cached automatically anymore unless you specifically flip the switch in the Discord developer panel to turn that on. I've swapped out the old function call in favor of client.users.fetch(id) and can confirm it is now fully working as intended :)

cheesits456 commented 3 years ago

Resolved in 11a41cef2c6e99168c1bd26dd1d38993629180d3