added version
This commit is contained in:
parent
8fa4f415f5
commit
516cc0b544
9
TODO
9
TODO
@ -1 +1,10 @@
|
|||||||
- banlist (after XX attempts ban for XX hours, banned users list in config file)
|
- banlist (after XX attempts ban for XX hours, banned users list in config file)
|
||||||
|
- add service difinition
|
||||||
|
- add deb packaging
|
||||||
|
- logging
|
||||||
|
- message localization
|
||||||
|
- put config in /etc, if doesn't exist, load local file
|
||||||
|
- user settings (activation time, etc)
|
||||||
|
- command extension (/record for recording audio)
|
||||||
|
- unpair other usernames
|
||||||
|
- directory monitoring, for message spooling
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
daemon = false
|
daemon = false
|
||||||
token = 347279594:AAH33Q3F2YYhAH3gkD6h2M3EqpH9H6Ht32c
|
token = 347279594:AAH33Q3F2YYhAH3gkD6h2M3EqpH9H6Ht32c
|
||||||
pair_pin = 1234
|
pair_pin = 1234
|
||||||
|
spool_dir = ./spool
|
||||||
|
|
||||||
[id-173581]
|
[id-173581]
|
||||||
username = zuzu
|
username = zuzu
|
||||||
@ -12,4 +13,3 @@ lastname = Pao
|
|||||||
username = pasperti
|
username = pasperti
|
||||||
firstname = Paolo
|
firstname = Paolo
|
||||||
lastname = Asperti
|
lastname = Asperti
|
||||||
|
|
||||||
|
@ -2,3 +2,4 @@
|
|||||||
daemon = false
|
daemon = false
|
||||||
token = aaaaaaaaaaaaaaaaaaaaaaaaa
|
token = aaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
pair_pin = 1234
|
pair_pin = 1234
|
||||||
|
spool_dir = /var/spool/telegram-notify
|
||||||
|
@ -6,8 +6,10 @@ import re
|
|||||||
import ConfigParser
|
import ConfigParser
|
||||||
import telepot
|
import telepot
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
from telepot.loop import MessageLoop
|
from telepot.loop import MessageLoop
|
||||||
|
|
||||||
|
version = 0.1
|
||||||
|
|
||||||
def writeconfig():
|
def writeconfig():
|
||||||
global configParser
|
global configParser
|
||||||
@ -30,8 +32,8 @@ def handle(msg):
|
|||||||
paired_user = [x for x in chat_ids if x['id'] == chat_id]
|
paired_user = [x for x in chat_ids if x['id'] == chat_id]
|
||||||
is_paired = len(paired_user) > 0
|
is_paired = len(paired_user) > 0
|
||||||
|
|
||||||
|
# if text starts with '/' then it's a command
|
||||||
if re.match('/',msg['text']):
|
if re.match('/',msg['text']):
|
||||||
# e' un comando
|
|
||||||
command = re.sub(r"\s.*",'',msg['text'])
|
command = re.sub(r"\s.*",'',msg['text'])
|
||||||
param = re.sub(r"^([^\s]+)\s","",msg['text'])
|
param = re.sub(r"^([^\s]+)\s","",msg['text'])
|
||||||
|
|
||||||
@ -87,6 +89,23 @@ def handle(msg):
|
|||||||
users = [x['username'] + ' (' + x['firstname'] + ' ' + x['lastname'] + ')\n' for x in chat_ids]
|
users = [x['username'] + ' (' + x['firstname'] + ' ' + x['lastname'] + ')\n' for x in chat_ids]
|
||||||
bot.sendMessage(chat_id, 'Paired users:\n' + "".join([str(i) for i in users]) )
|
bot.sendMessage(chat_id, 'Paired users:\n' + "".join([str(i) for i in users]) )
|
||||||
|
|
||||||
|
elif command == '/start':
|
||||||
|
bot.sendMessage(chat_id, 'Started:\n' )
|
||||||
|
|
||||||
|
elif command == '/help':
|
||||||
|
bot.sendMessage(chat_id, 'Help:\n' )
|
||||||
|
|
||||||
|
elif command == '/settings':
|
||||||
|
bot.sendMessage(chat_id, 'Settings:\n' )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for arg in sys.argv:
|
||||||
|
if arg=='-v' or arg=='--version':
|
||||||
|
print 'telegram-notify version %s - Copyright (C) 2018 by Paolo Asperti.' % version
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
configParser = ConfigParser.RawConfigParser()
|
configParser = ConfigParser.RawConfigParser()
|
||||||
configParser.read('telegram-notify.conf')
|
configParser.read('telegram-notify.conf')
|
||||||
|
Loading…
Reference in New Issue
Block a user