Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Commands Guild-Only #77

Closed
kaaax0815 opened this issue Dec 23, 2020 · 5 comments
Closed

Make Commands Guild-Only #77

kaaax0815 opened this issue Dec 23, 2020 · 5 comments

Comments

@kaaax0815
Copy link

kaaax0815 commented Dec 23, 2020

When DMing the Bot (prefix)play the bots prints error.
I found this: https://discordjs.guide/commando/guild-only.html but this only works when using commando
Error (hosted on replit):

      at WebSocket.emit (events.js:315:20)
} reason:  TypeError: Cannot read property 'voice' of null
    at Object.run (/home/runner/discordjs/commands/play.js:17:34)
    at module.exports (/home/runner/discordjs/events/message.js:32:9)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (/home/runner/discordjs/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/runner/discordjs/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:315:20)
@SudhanPlayz
Copy link
Owner

SudhanPlayz commented Dec 24, 2020

This doesnt the full error and just return before reading command if message was sent on dms

Also we dont use commando

@kaaax0815
Copy link
Author

kaaax0815 commented Dec 24, 2020

This is the Full Log:

Unhandled Rejection at:  Promise {
  <rejected> TypeError: Cannot read property 'voice' of null
      at Object.run (/home/runner/discordjs/commands/play.js:17:34)
      at module.exports (/home/runner/discordjs/events/message.js:32:9)
      at Client.emit (events.js:315:20)
      at MessageCreateAction.handle (/home/runner/discordjs/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
      at Object.module.exports [as MESSAGE_CREATE] (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
      at WebSocketManager.handlePacket (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
      at WebSocketShard.onPacket (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
      at WebSocketShard.onMessage (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
      at WebSocket.onMessage (/home/runner/discordjs/node_modules/ws/lib/event-target.js:132:16)
      at WebSocket.emit (events.js:315:20)
} reason:  TypeError: Cannot read property 'voice' of null
    at Object.run (/home/runner/discordjs/commands/play.js:17:34)
    at module.exports (/home/runner/discordjs/events/message.js:32:9)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (/home/runner/discordjs/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/runner/discordjs/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/runner/discordjs/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:315:20)

Yeah as i said that you dont use Commando

@SudhanPlayz
Copy link
Owner

Just return on events/message.js if message channel type is dm

@kaaax0815
Copy link
Author

I think thats a "feature" you should put on your todo list. i think the console line would be happy xd (sorry for the bad joke)

@SudhanPlayz
Copy link
Owner

Lmao, yea sure will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants