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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; News bot
;; By Arthas
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dialog news {
title "News bot - Arthas"
size -1 -1 86 114
option dbu notheme
list 1, 4 30 77 50, size
edit "", 2, 4 4 77 12, autohs
button "Add", 3, 5 17 23 12
button "Clear", 4, 31 17 23 12
button "Remove", 5, 57 17 23 12
edit "", 6, 7 95 50 12
box "Channel", 7, 5 88 76 21
button "Set", 8, 60 95 17 12
text "", 9, 4 81 77 8, center
}
dialog newsinfo {
title "Info"
size -1 -1 84 34
option dbu notheme
edit "", 1, 3 4 78 12, autohs
button "Update", 2, 22 18 37 12, ok
}
on *:dialog:news*:*:*:{
if ($dname == news) {
if ($devent == init) { did -a $dname 6 %news.channel | var %o = 1 | while (%o <= $lines(News.txt)) { did -a $dname 1 $read(News.txt, %o) | inc %o } | did -a $dname 9 $newline($lines(News.txt)) }
elseif ($devent == sclick) {
if ($did == 3) && (* iswm $did(2)) { did -a $dname 1 $did(2) | write News.txt $did(2) | did -a $dname 9 $newline($lines(News.txt)) }
if ($did == 8) && (#* iswm $did(6)) { set %news.channel $did(6) }
if ($did == 4) { .remove News.txt | did -r $dname 1 | did -a $dname 9 $newline($lines(News.txt)) }
if ($did == 5) && ($did($dname,1).sel) { did -d $dname 1 $did($dname,1).sel | .write -dl $+ $did($dname,1).sel News.txt | did -a $dname 9 $newline($lines(News.txt)) }
}
elseif ($devent == dclick) {
if ($did == 1 && $did($dname,1).sel) { set %line $did($dname,1).sel | dialog $iif($dialog(Newsinfo),-v Newsinfo,-m Newsinfo Newsinfo) | did -r Newsinfo 1 | did -a newsinfo 1 $did($dname,1).seltext }
}
}
elseif ($dname == newsinfo) {
if ($devent == sclick) {
if ($did == 2) && ($did(1)) { did -r news 1 | write -l $+ %line News.txt $did(1) | var %o = 1 | while (%o <= $lines(News.txt)) { did -a news 1 $read(News.txt, %o) | inc %o } }
}
}
}
on @*:text:!News:%News.channel: if (!%news.flood) { if ($me isop #) { mode # +m | .timer 1 $calc(%i +2) mode # -m } | var %o = 1,%i = 1 | while (%o <= $lines(News.txt)) { .timer 1 %i msg # $read(News.txt, %o) | inc %i | inc %o } | inc -u20 %news.flood }
menu * {
News dialog: dialog $iif($dialog(News),-v News,-m News News)
}
alias newline { return There $iif($1 == 1,is,are) $iif($1 == 0,no,$1) $iif($1 == 1,line,lines) of news. }
|