יוצר: KaryoS
גירסא: 1.0
תיאור: כנסו לדיאלוג וזה יהיה פשוט
הפעלה: דיאלוג
דרישות: ___
תמונה:
תודה לArthas על עזרה עם הדיאלוג
קוד: בחר הכל
; ——————————————————————————————————————————————————————————————————————————————————————————————— ;
; KaryoS News Bot - v1.0
; ——————————————————————————————————————————————————————————————————————————————————————————————— ;
Menu * {
Newsbot dialog:dialog -m news news
}
dialog news {
title "Newsbot By KaryoS"
size -1 -1 170 150
option dbu
tab "Settings", 1, -8 -20 200 200
text "Channel:", 2, 6 19 22 8, tab 1
edit "", 3, 29 18 59 10, tab 1
text "Status:", 4, 6 30 19 8, tab 1
radio "ON", 5, 26 29 18 10, tab 1
text "Sign:", 7, 6 41 14 8, tab 1
edit "", 8, 22 40 13 10, tab 1
radio "OFF", 6, 47 29 21 10, tab 1
text "How to send the news:", 9, 6 53 56 8, tab 1
button "Save", 10, 89 18 17 10, tab 1
button "Save", 31, 36 40 17 10, tab 1
radio "Automatic timer", 42, 63 52 48 10, tab 1
radio "By command", 30, 113 52 41 10, tab 1
tab "Messages", 20
edit "", 33, 6 20 92 10, tab 20 multi autohs
text "", 34, 18 116 77 8, tab 20 center
list 23, 5 54 94 62, tab 20 size
button "Add", 22, 6 41 30 12, tab 20
button "Remove", 24, 37 41 30 12, tab 20
button "Clear", 25, 68 41 30 12, tab 20
edit "", 35, 6 31 92 10, tab 20
button "Settings", 36, 21 2 30 12
button "Messages", 37, 51 2 30 12
}
dialog newsinfo {
title "Info"
size -1 -1 85 40
option dbu
edit "", 1, 3 2 78 12, autohs
edit "", 3, 3 15 78 10
button "Update", 2, 21 27 37 11,ok
}
on *:dialog:news*:*:*: {
if ($dname == news) {
if ($devent == sclick) {
if ($did == 25) { .remove News.txt | did -r $dname 23 | did -a $dname 34 There are no lines of news. }
if ($did == 24 && $did($dname,23).sel) { did -d $dname 23 $did($dname,23).sel | .write -dl $+ $did($dname,23).sel News.txt | did -a $dname 34 There $iif($lines(News.txt) == 1,is,are) $iif($lines(News.txt) == 0,no,$lines(News.txt)) $iif($lines(News.txt) == 1,line,lines) of news. }
if ($did == 37) { did -c $dname 20 | dialog -s news -1 -1 205 250 }
if ($did == 36) { did -c $dname 1 | dialog -s news -1 -1 318 133 }
if ($did == 10 && #* iswm $did(3)) { set %newschan $did(3) | .timer 1 2 join %newschan | .echo -a News Channel is now: %newschan }
if ($did == 31) { set %newssign $did(8) | .echo -a News Sign is now: %newssign }
if ($did == 5) { set %newsondid2 5 | $iif(%newsondid,did -c $dname %newsondid) | set %newsstatus ON | echo -a News Status is now: ON }
if ($did == 6) { set %newsondid2 6 | $iif(%newsondid,did -c $dname %newsondid) | set %newsstatus OFF | echo -a News Status is now: OFF }
if ($did == 30) { set %newsondid 30 | $iif(%newsondid2,did -c $dname %newsondid2) | set %newsnews on | set %newstimer off | .timernews off }
if ($did == 42) { set %newsondid 42 | $iif(%newsondid2,did -c $dname %newsondid2) | set %newsnews off | set %newstimer on | set %Timer $input(Set Timer Time,e,Set Timer Time,%Timer) | .timernews 0 %Timer news }
if ($did == 22 && * iswm $did(33)) { did -a $dname 23 $did(33) | write News.txt $did(33) | did -a $dname 34 There $iif($lines(News.txt) == 1,is,are) $iif($lines(News.txt) == 0,no,$lines(News.txt)) $iif($lines(News.txt) == 1,line,lines) of news. }
}
if ($devent == edit) && ($did == 33) { did -i $dname 35 1 text +m $iif($did(33),$v1,$crlf) }
if ($devent == init) {
dll mdx.dll MarkDialog $dname
dll mdx.dll SetDialog $dname bgcolor $rgb(93,138,168)
dll mdx.dll SetColor $dname 3,23,33,8 textbg $rgb(250,250,250)
dll mdx.dll SetColor $dname 3,23,33,8 background $rgb(250,250,250)
dll mdx.dll SetColor $dname 3,23,33,8 text $rgb(50,0,0)
dll mdx.dll SetColor $dname 36,37,25,24,22,34,30,42,31,10,9,6,7,5,4,2 textbg $rgb(93,138,168)
dll mdx.dll SetColor $dname 36,37,25,24,22,34,30,42,31,10,9,6,7,5,4,2 background $rgb(93,138,168)
dll mdx.dll SetColor $dname 35 background $rgb(192,192,192)
dll mdx.dll SetColor $dname 35 textbg $rgb(192,192,192)
dll mdx.dll SetBorderStyle 3,33,8
dll mdx.dll SetControlMDX $dname 35 ComboBoxEx drop > views.mdx
dll mdx.dll SetControlMDX $dname 35 richedit return read multi autohs > ctl_gen.mdx
var %x = 1 | while (%x <= $lines(News.txt)) { did -a $dname 23 $read(News.txt, %x) | inc %x } | did -a $dname 34 There $iif($lines(News.txt) == 1,is,are) $iif($lines(News.txt) == 0,no,$lines(News.txt)) $iif($lines(News.txt) == 1,line,lines) of news.
dialog -s news -1 -1 318 133
if (%newschan) { did -a $dname 3 %newschan }
if (%newssign) { did -a $dname 8 %newssign }
if (%newsstatus == on) { did -c $dname 5 | set %newsondid2 5 }
else { did -c $dname 6 | set %newsondid2 6 }
if (%newsnews == on) { did -c $dname 30 | set %newsondid 30 }
if (%newstimer == on) { did -c $dname 42 | set %newsondid 42 }
}
if ($devent == dclick) && ($did == 23) && ($did($dname,23).sel) { set %line $did($dname,23).sel | dialog $iif($dialog(Newsinfo),-v Newsinfo,-m Newsinfo Newsinfo) | did -a newsinfo 1 $did(23).seltext | did -i newsinfo 3 1 text +m $did(23).seltext }
}
if ($dname == newsinfo) {
if ($devent == init) {
dll mdx.dll MarkDialog $dname
dll mdx.dll SetDialog $dname bgcolor $rgb(192,192,192)
dll mdx.dll SetColor $dname 2 textbg $rgb(192,192,192)
dll mdx.dll SetColor $dname 2 background $rgb(192,192,192)
dll mdx.dll MarkDialog $dname | dll mdx.dll SetControlMDX $dname 3 ComboBoxEx drop > views.mdx | dll mdx.dll SetControlMDX $dname 3 richedit return read multi autohs > ctl_gen.mdx
}
if ($devent == edit) { did -i $dname 3 1 text +m $iif($did(1),$v1,$crlf) }
if ($devent == sclick) && ($did == 2) && ($did(1)) { did -r news 23 | write -l $+ %line News.txt $did(1) | var %o = 1 | while (%o <= $lines(News.txt)) { did -a news 23 $read(News.txt, %o) | inc %o } }
}
}
alias news { $iif($me isop %newschan,mode %newschan +m) | var %x 1 | while ($read(News.txt, %x)) { .timer 1 %x msg %newschan $v1 | inc %x } | $iif($me isop %newschan,.timer 1 $calc(%x +1) mode %newschan -m) }
on *:Connect: { if (%newstimer == on) { set %Timer $input(Set Timer Time,e,Set Timer Time,%Timer) | .timernews 0 %Timer news } }
on *:text:*:%newschan: { if (%newsstatus == on) && (!%flooding) && ($me isop %newschan) { if ($1 == !news) && (%newsnews == on) { news | set -u6 %flooding ON } } }