Skip to content

Conversation

C1tas
Copy link

@C1tas C1tas commented Sep 13, 2018

#9

Copy link
Collaborator

@roberthoenig roberthoenig left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this @C1tas! Left some comments below, but I didn't try out the code yet. Maybe @punchagan is up for testing these changes? (I haven't run errbot in quite a while, and it'd take a long time to set up).

zulip.py Outdated

def send_message(self, msg):
super().send_message(msg)
# import pdb ; pdb.set_trace()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an artifact from debugging, should be removed.

zulip.py Outdated

def extract_identifiers_from_string(self, text):
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of this empty docstring?

zulip.py Outdated
if len(re_res.groups()) > 0:
username = re_res[1]

# import pdb ; pdb.set_trace()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another debugging artifact.

emails=[txtrep],
client=self.client)

log.debug('building an identifier from %s.', txtrep)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another debugging artifact.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(Or do other backends actually log something here?)

zulip.py Outdated
username, streamname, topicname = self.extract_identifiers_from_string(txtrep)

if username:

Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant newline.

README.md Outdated

* Rooms in ErrBot are streams in Zulip.

#### directly send msg to room
Copy link
Collaborator

Choose a reason for hiding this comment

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

In user-facing documentation, words like "message" shouldn't be abbreviated. It'd also be nice to have a paragraph or two explaining what goes into the double brackets, and when you would want to "directly send msg to room"

if self.check_email(text):
username = text

if text[0] == "#":
Copy link
Collaborator

Choose a reason for hiding this comment

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

The logic in this if-statement is rather complicated. Perhaps there is a simpler way to parse this? Maybe something that involves extracting every occurrence of {{}} and making the if-statements switch based on the number of these statements.

Copy link
Author

Choose a reason for hiding this comment

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

sry for my poor regex skill, if you have some cool idea, just instead of using my poor code

README.md Outdated
self.send(
self.build_identifier("#{{code_runtime_alert}}*{{hello}}"),
"test"
)
Copy link
Member

Choose a reason for hiding this comment

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

If we expect the send method to be called directly by users, is it worth adding regexes and complex logic to the build_identifier method? We could just have a function that creates the appropriate ZulipRoom instance given the stream and topic?

Copy link
Author

Choose a reason for hiding this comment

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

I think it depend on user. And the reason why i use function send like this is that i found err-bot official docs using code like this.

errbot-official docs

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough. I just felt it would be easier to have stream and topic as separate arguments, but if this is the documented way of doing it, then so be it.

@benjamin-bergia
Copy link

benjamin-bergia commented Feb 7, 2023

Hi,

is there any chance of this getting merged?

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

Successfully merging this pull request may close these issues.

4 participants