-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript1.mrc
More file actions
39 lines (33 loc) · 947 Bytes
/
script1.mrc
File metadata and controls
39 lines (33 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
].on *:TEXT:!weather *:#: {
var %location = $1
if ($len(%location) == 0) {
msg $chan Usage: !weather <location>
return
}
; Validate input
if ($wildsite(%location)) {
msg $chan Invalid input. Please enter a valid location.
return
}
var %weatherFile = $+($mircdir,weather.txt)
; Execute curl command and save output to a file
.run -r %windir%\syswow64\curl.exe -o %weatherFile wttr.in/%location?format=j1
; Check for errors
if ($error) {
msg $chan Error: Failed to retrieve weather information for %location.
.remove %weatherFile
return
}
; Read the contents of the file
var %weather = $read(%weatherFile)
; Check for errors
if (!$error) {
msg $chan Debug: %weatherFile
msg $chan %weather
}
else {
msg $chan Error: Failed to retrieve weather information for %location.
}
; Delete the temporary file
.remove %weatherFile
}