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

Legacy Issue: Started typing and failsafe broken #9

Closed
JamesLongman opened this issue Aug 30, 2018 · 0 comments
Closed

Legacy Issue: Started typing and failsafe broken #9

JamesLongman opened this issue Aug 30, 2018 · 0 comments
Assignees
Labels
Bug Something isn't working

Comments

@JamesLongman
Copy link
Contributor

JamesLongman commented Aug 30, 2018

This issue was quite complex and remained open for the majority of our previous active development, it was a low priority bug.

Original issue by Maelstromeous:

Maelstromeous:
Disabled entirely for now. Need to have it more reliably start and stop typing.

James:
This was a problem of two parts:

  1. The command to stop and start typing was being called and stopped in an inconsistent way - fixed
  2. The command to stop typing is sent but it doesn't work

I have solved the first but the second is far harder to nail down. As far as I can tell this is an API problem and there's nothing we can do. One possible solution could be to somehow wait for the stop typing command to definitely go through, and only then post the message.

Gunna leave this for someone else to take a shot at for now

Euwas:
What exactly is the issue with the start and stop typing notification? On my test server it seems to be working during a 5 minute test. Does it fail when multiple messages occur at once?

The start and stop call increase and decrease counters. Uneven calls may leave the notification active. the stop method does take an argument to force the removal of the notification though, so you can always stop it.

James:
The issue is sometimes it gets stuck on typing, repro is a bit hard as it's random but try it a few times and it'll happen. I would guess this is due to the request to stop typing being sent and it not going through, force argument didn't have an effect when I was trying to fix it, but I may have been using it wrong as I had no idea what I was doing 2 weeks ago

This may have fixed itself with discord.js 10.0.1 I'd check the force argument again

James:
Just got this again. console.log showed:
[1:15:28 AM] [WARNING] (discordbot) stopTyping timeout executed...
but it didn't stop typing, command was !ping and reply came back quickly as expected

Maelstromeous:
I wonder if it's because local commands are sent too quickly and aren't being stopped?

James:
Dunno I didn't look into it, sometimes the typing starts after the message has already been sent though. And that stopTyping timeout seems to send no matter what

Maelstromeous:
I wonder if the stop typing failsafe is failing because the msg object is no longer available to have it's stop typing message sent on? Is there a way to stop a bot from typing on a particular server?

A solution could be to build an array of channel IDs as the message comes in, and if the stop typing command has kicked in for that channel, clear it. Otherwise, send the force command.

Surely other bots have got this nailed down?

Not IDs... Full msg.channel objects... This gonna be fun.

James:
Well I still haven't taken a proper look, but at a glance I'd guess it's because you haven't used clearTimeout() to kill the failsafe if you get a good reply. Also the timeout variable is global and not function level which is asking for trouble.

I don't know how other bots have been handling it but I haven't heard bad things about this feature since v9/10. I can take another look if you can't figure it out the last time I looked at this issue was 3 months ago like 2 days after I learned JS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants