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

irc: add safe_text_length and use abc.ABC for AbstractBot #2136

Merged
merged 1 commit into from
Aug 19, 2021

Conversation

Exirel
Copy link
Contributor

@Exirel Exirel commented Jul 2, 2021

Description

Tin. I was always a bit annoyed by the say method that does too much on its own, and I know that @half-duplex wanted a way to know the safe length for an IRC message without having to reinvent the wheel each time. I hope this will help, even if just a little.

Working on this part, I saw that hostmask is used but not defined by the abstract class, so I took this opportunity to use abc.ABC and the abc.abstractmethod decorator.

By doing so, I also replaced the KeyError when the hostmask is not defined to return None instead. This is a very minor breaking change. I'm not sure anyone is using bot.hostmask, and they probably don't use it when the bot is not connected/hasn't join a channel yet.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

@Exirel Exirel added Tweak Breaking Change Stuff that probably should be mentioned in a migration guide labels Jul 2, 2021
@Exirel Exirel added this to the 8.0.0 milestone Jul 2, 2021
@Exirel Exirel requested a review from a team July 2, 2021 17:55
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can think of no objections. It's mostly my code, just moved somewhere else. 😁

@Exirel
Copy link
Contributor Author

Exirel commented Jul 5, 2021

Your code, with more tests. 😁

@Exirel Exirel force-pushed the irc-safe-text-length branch from edba959 to 023f686 Compare July 5, 2021 06:57
@dgw dgw merged commit 0a8b033 into sopel-irc:master Aug 19, 2021
@dgw dgw mentioned this pull request Oct 25, 2021
4 tasks
@Exirel Exirel deleted the irc-safe-text-length branch December 31, 2021 21:19
@SnoopJ SnoopJ added the Feature label Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change Stuff that probably should be mentioned in a migration guide Feature Tweak
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants