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

Support Bark #19

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Support Bark #19

wants to merge 5 commits into from

Conversation

FisherCats
Copy link
Contributor

Add Bark Backends and docs

@IsshikiHugh
Copy link
Owner

IsshikiHugh commented Jan 16, 2025

Hi, I am currently working on improving the code quality. So the PR would be reviewed later.

Meanwhile, you are supposed to keep syncing with the latest main branch. (Mainly for performing checks.)

Thanks for contributing.

@FisherCats
Copy link
Contributor Author

OK, that's great, improving code quality is not easy, thanks for your excellent work ! Should I close this PR and re-pull it ?

@IsshikiHugh
Copy link
Owner

OK, that's great, improving code quality is not easy, thanks for your excellent work ! Should I close this PR and re-pull it ?

Actually you just need to run blue .. Check the new contributing instructions for details.

As for keeping or closing, it depends on you.

@FisherCats FisherCats closed this Jan 16, 2025
@FisherCats FisherCats reopened this Jan 16, 2025
Copy link
Owner

@IsshikiHugh IsshikiHugh left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.
I have commented some problems with code quality.
Meanwhile, I think it's better to leverage the benefits of bark's multi-levels notification support.
Currently the logic is totally the same as real-time message APP like DingTalk, wasting the flexibility of the framework, resulting code redundancy.
For bark, I think it can be better to send passive message for exp start, active message for exp finished, timeSensitive/active for error message.
I am not familiar with bark currently, but I think using the plain logic wastes a lot.

# Setup.
self.cfg = cfg
self.device_token = cfg['device_token']
self.url = 'https://api.day.app/' + self.device_token
Copy link
Owner

Choose a reason for hiding this comment

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

Bad (ambiguous) variable names.
You have 'url' in configuration setting, but you also have self.url which is generated with device_token, the two 'url' are not the same things. You need to assign better variable names.

self.icon = '' # TODO: add icon support.

def _gen_sign(self, secret):
timestamp = int(datetime.now().timestamp())
Copy link
Owner

Choose a reason for hiding this comment

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

Useless function. Plz remove.

smtp_port: <?>
sender_email: sender_email=<?> # [email protected]
sender_pwd: sender_pwd=<?>
receiver_email: receiver_email=<?> # [email protected]
Copy link
Owner

Choose a reason for hiding this comment

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

Pay attention to this. I have fixed the problem this time.


def format_information(self) -> dict:
information = {
'title': f'{self.readable_time} @ {self.host}',
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think this is the best choice for tittle.

def format_information(self) -> dict:
# Never send empty paragraph, it would be ugly.
information = {
'title': f'{self.readable_time} @ {self.host}',
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think this is the best tittle.

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.

2 participants