Added RASP module
This commit is contained in:
parent
0361814459
commit
4c3a21e562
11
README.md
11
README.md
|
@ -617,6 +617,17 @@ Admin commands to manage users.
|
|||
* !users list [pattern] - List users matching wildcard pattern (must be owner)
|
||||
* !users kick [pattern] - Kick users matching wildcard pattern from room (must be admin in room)
|
||||
|
||||
### RASP (Gliding Weather forecast)
|
||||
|
||||
Currently only Finnish RASP supported. Uses data from http://ennuste.ilmailuliitto.fi/
|
||||
|
||||
#### Usage
|
||||
|
||||
* !rasp [day] [hour] - Fetch RASP for specified day and hour
|
||||
|
||||
Day and hour can be omitted - fetches today's forecast if not set.
|
||||
PR welcome for supporting other data sources.
|
||||
|
||||
## Bot setup
|
||||
|
||||
* Create a Matrix user
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
from modules.common.module import BotModule
|
||||
import urllib.request
|
||||
|
||||
class MatrixModule(BotModule):
|
||||
async def matrix_message(self, bot, room, event):
|
||||
args = event.body.split()
|
||||
args.pop(0)
|
||||
day = 0
|
||||
hour = 12
|
||||
if len(args) >= 1:
|
||||
day = int(args[0]) - 1
|
||||
if len(args) == 2:
|
||||
hour = int(args[1])
|
||||
|
||||
imgurl = 'http://ennuste.ilmailuliitto.fi/' + str(day) + '/wstar_bsratio.curr.' + str(hour) + '00lst.d2.png'
|
||||
await bot.upload_and_send_image(room, imgurl, f"RASP Day {day+1} at {hour}:00")
|
||||
|
||||
def help(self):
|
||||
return 'RASP Gliding Weather forecast, Finland only'
|
Loading…
Reference in New Issue