mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 03:43:19 +00:00
d03866f0e3
Add sending message functionality
19 lines
584 B
Python
19 lines
584 B
Python
import logging
|
|
import os
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def notify(msg, subtitle='New message', title='Telegram'):
|
|
msg = '-message {!r}'.format(msg)
|
|
subtitle = '-subtitle {!r}'.format(subtitle)
|
|
title = '-title {!r}'.format(title)
|
|
sound = '-sound default'
|
|
icon_path = os.path.join(os.path.dirname(__file__), 'tg.png')
|
|
icon = f'-appIcon {icon_path}'
|
|
cmd = '/usr/local/bin/terminal-notifier'
|
|
|
|
logger.debug('####: %s', f'{cmd} {icon} {sound} {title} {subtitle} {msg}')
|
|
os.system(
|
|
f'{cmd} {icon} {sound} {title} {subtitle} {msg}'
|
|
)
|