Support mentions

This commit is contained in:
Guy Van Sanden 2024-03-20 11:38:18 +01:00
parent f9d1c49e19
commit 538d5f3556
3 changed files with 8 additions and 3 deletions

View File

@ -1,2 +1,5 @@
TellMe (1.3.0)
* Add support for mentions (-n)
TellMe (1.2.0) TellMe (1.2.0)
* Feature complete version * Feature complete version

View File

@ -1,6 +1,6 @@
{ {
"name": "TellMe", "name": "TellMe",
"version": "1.2.0", "version": "1.3.0",
"description": "TellMe CLI", "description": "TellMe CLI",
"scripts": { "scripts": {
"dev": "webpack-dev-server --inline --hot" "dev": "webpack-dev-server --inline --hot"

View File

@ -18,7 +18,7 @@ def signal_handler(signal, frame):
print('Exit...') print('Exit...')
sys.exit(0) sys.exit(0)
def sendmessage (message): def sendmessage(message):
global ran global ran
# mymessage=hostname.upper() + ': ' +message # mymessage=hostname.upper() + ': ' +message
mymessage = ("%s on %s" % (message, hostname.upper())) mymessage = ("%s on %s" % (message, hostname.upper()))
@ -29,6 +29,7 @@ def sendmessage (message):
url = ("%s/api/webhook/%s" % (baseurl, webhook)) url = ("%s/api/webhook/%s" % (baseurl, webhook))
myreq = {} myreq = {}
myreq['message'] = mymessage myreq['message'] = mymessage
myreq['notify'] = notify
r = requests.post(url, json = { 'message': mymessage, 'tts': args.tts }) r = requests.post(url, json = { 'message': mymessage, 'tts': args.tts })
if r.status_code == 200: if r.status_code == 200:
@ -53,7 +54,8 @@ parser.add_argument("-m", "--message", default="Your process finished", help="Me
parser.add_argument('-t', '--tts', default=False, action='store_true', help="Send message to TTS") parser.add_argument('-t', '--tts', default=False, action='store_true', help="Send message to TTS")
parser.add_argument('-v', '--version', action='version', version=versionstring) parser.add_argument('-v', '--version', action='version', version=versionstring)
parser.add_argument('-p', '--pid', action="store", dest="pid", type=int, default=0) parser.add_argument('-p', '--pid', action="store", dest="pid", type=int, default=0)
parser.add_argument('-n', '--interval', action="store", dest="interval", type=int, default=5, help="Set the interval of commands like watch that use it") parser.add_argument('-n', '--notify' action="store", dest="notify", default=None, help="Notify specific id")
parser.add_argument('-i', '--interval', action="store", dest="interval", type=int, default=5, help="Set the interval of commands like watch that use it")
parser.add_argument('-w', '--watch', action="store", dest="watchcommand", help="Run the given command every n or 5 minutes") parser.add_argument('-w', '--watch', action="store", dest="watchcommand", help="Run the given command every n or 5 minutes")
parser.add_argument('-c', '--config', default=home +"/.config/tellme/config.json" ,help="Path to config file") parser.add_argument('-c', '--config', default=home +"/.config/tellme/config.json" ,help="Path to config file")
parser.add_argument('-P', '--ping', action="store", dest="pinghost", type=str, help="Ping a host until it is up") parser.add_argument('-P', '--ping', action="store", dest="pinghost", type=str, help="Ping a host until it is up")