Add configuration support
This commit is contained in:
parent
f7d4db136d
commit
d8bb26ab9b
13
bin/telelog
13
bin/telelog
@ -50,5 +50,18 @@ async def log(event):
|
|||||||
f = open(chat)
|
f = open(chat)
|
||||||
await event.edit(f.read())
|
await event.edit(f.read())
|
||||||
|
|
||||||
|
if msg.startswith('.tl.set'):
|
||||||
|
import json
|
||||||
|
key = msg.split()[1]
|
||||||
|
arg = msg.split()[2]
|
||||||
|
with open('/var/telelog/settings.json', 'r+') as settings:
|
||||||
|
data = json.load(settings)
|
||||||
|
data[f'{key}'] = arg
|
||||||
|
settings.seek(0)
|
||||||
|
json.dump(data, settings, indent=4)
|
||||||
|
settings.truncate()
|
||||||
|
settings.close()
|
||||||
|
await event.edit(f'Setting changed: {key} = {arg}.\n')
|
||||||
|
|
||||||
client.start()
|
client.start()
|
||||||
client.run_until_disconnected()
|
client.run_until_disconnected()
|
||||||
|
1
install
1
install
@ -41,6 +41,7 @@ addfiles(){
|
|||||||
install -dm770 -o root -g telelog /var/telelog/logs
|
install -dm770 -o root -g telelog /var/telelog/logs
|
||||||
install -m640 -o root -g telelog config.py /var/telelog/config.py
|
install -m640 -o root -g telelog config.py /var/telelog/config.py
|
||||||
install -m755 -o root -g root bin/telelog /usr/bin/telelog
|
install -m755 -o root -g root bin/telelog /usr/bin/telelog
|
||||||
|
echo '{}' > /var/telelog/settings.json
|
||||||
|
|
||||||
# Install service files on installed inits
|
# Install service files on installed inits
|
||||||
if [ -e /sbin/openrc ]
|
if [ -e /sbin/openrc ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user