weather.py für ansiweather

This commit is contained in:
plocki 2020-01-30 21:56:03 +01:00
parent bef686bd29
commit 041ac0e976
1 changed files with 16 additions and 0 deletions

16
modules/weather.py Normal file
View File

@ -0,0 +1,16 @@
import subprocess
import os
class MatrixModule:
async def matrix_message(self, bot, room, event):
args = event.body.split()
args.pop(0)
encoding="utf-8"
# get weather from ansiweather
result = subprocess.check_output(["ansiweather","-a false","-l", ' '.join(args)])
await bot.send_text(room, result.decode(encoding))
def help(self):
return('How\'s the weather?')