modmail-dev / Modmail

A Discord bot that functions as a shared inbox between staff and members, similar to Reddit's Modmail.
https://docs.modmail.dev
GNU Affero General Public License v3.0
1.58k stars 4.59k forks source link

fix ping command returning an AttributeError #3256

Closed japandotorg closed 1 year ago

japandotorg commented 1 year ago

basically fixes this issue

Traceback (most recent call last):
  File "/home/ubuntu/.local/share/virtualenvs/modmail-7dS7szwO/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/ubuntu/modmail/core/utils.py", line 558, in wrapper
    return await func(self, ctx, *args, **kwargs)
  File "/home/ubuntu/modmail/cogs/utility.py", line 617, in ping
    description=f"{self.bot.ws.latency * 1000:.4f} ms",
AttributeError: 'NoneType' object has no attribute 'latency'
ghost commented 1 year ago

Cant repro this issue, can you tell me what you're trying to do thats causing this error?

japandotorg commented 1 year ago

Oh wait, I think I know why, my bad!