weather.py für ansiweather
This commit is contained in:
parent
bef686bd29
commit
041ac0e976
|
@ -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?')
|
Loading…
Reference in New Issue