Derpius / pythonsourceserverdiscordbot

Discord bot for my Python source server query library
GNU General Public License v3.0
3 stars 1 forks source link

[bug] Discord message can have length 0 breaking command check #16

Closed Derpius closed 3 years ago

Derpius commented 3 years ago

Describe the bug When a user in Discord uploads a file (possibly in other scenarios too) they send a message with an embedded image, and a message of length 0.
This causes checking char 0 of the message text to see if it's a command that should not be relayed to the bot throws index out of range.

To Reproduce

  1. Enable relay Discord side with !relayHere
  2. Upload a file to the relaying channel
  3. Find string index out of range exception in the bot's console

Expected behavior Message would just not attempt to relay as it has a length of 0.

Derpius commented 3 years ago

I think bots may also be able to have a prefix longer than a single char so the command check needs to be modified for that too

Derpius commented 3 years ago

Fixed in b8ffbb824e588383eb003d2459f6c08d43fbb45f