Skip to content

halibot: adds repr and str functions for message class#123

Merged
sjrct merged 1 commit into
Halibot:masterfrom
mracine:issue-97
Feb 6, 2019
Merged

halibot: adds repr and str functions for message class#123
sjrct merged 1 commit into
Halibot:masterfrom
mracine:issue-97

Conversation

@mracine

@mracine mracine commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

Perhaps we can open up some discussion for how we want to show message information but we can utilize both repr() (for verbose object printing) and str() (for readable object printing) if we want, but what we want to display in str() is up for discussion. Also, I'm not sure what the process is for adding new tests but I wanted to verify I could recreate a message from repr(). If the tests don't make sense or should go somewhere else, please let me know.

Also, for reference: #97

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.05%) to 94.769% when pulling 4a0c9a6 on mracine:issue-97 into e033e85 on Halibot:master.

@richteer
richteer requested a review from sjrct October 5, 2018 15:28
Comment thread halibot/message.py
return '/'.join(self.target.split('/')[1:])

def __repr__(self):
return "halibot.Message(body='{}', type='{}', author='{}', identity='{}', origin='{}', misc='{}', target='{}')".format(self.body, self.type, self.author, self.identity, self.origin, self.misc, self.target)

@sjrct sjrct Jan 31, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

f"halibot.Message(body='{self.body}', ...)" would be better.

@sjrct

sjrct commented Jan 31, 2019

Copy link
Copy Markdown
Member

I only took three months since the end of Hacktoberfest

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