-
Notifications
You must be signed in to change notification settings - Fork 28
/
ircidle.tcl
89 lines (76 loc) · 2.37 KB
/
ircidle.tcl
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package require http
#set channel where script should work
set conf(channel) "#09source"
set conf(chan) "#09source"
set conf(site) "09source"
set conf(key) "VGhlIE1vemlsbGEgZmFtaWx5IGFwcG"
set conf(site_url) "http://u-232.com/irc_idle.php"
#set the file where greet message is
set gfile "text/greet.txt"
#bind process
bind join - "#09source *" bind_join
bind part - "#09source *" bind_part
bind sign - "#09source *" bind_sign
bind nick - "#09source *" bind_nick
#bind join - "$channel *" bind_join
#bind part - "$channel *" bind_part
#bind sign - "$channel *" bind_sign
#bind nick - "$channel *" bind_nick
proc bind_join {nick host handle chan} {
set check [user_check $nick]
if { $check == 1 } {
irc_idle $nick 1
#hello $nick
}
}
proc bind_part {nick host handle chan msg} {
irc_idle $nick 0
}
proc bind_nick {nick host handle chan newnick} {
set check [user_check $nick]
if { $check == 1 } {
irc_idle $newnick 1
#hello $nick
}
}
proc bind_sign {nick host handle chan msg} {
irc_idle $nick 0
}
proc irc_idle { user irc_idle } {
global conf
set token [::http::geturl $conf(site_url)?key=$conf(key)&do=idle&username=$user&ircidle=$irc_idle]
set result [::http::data $token]
if { $result == 1 && $irc_idle == 1 } {
putquick "notice $user : <+> Irc bonus enabled"
} elseif { $result == 1 && $irc_idle == 0 } {
putquick "PRIVMSG $conf(chan) : \0032<*> Irc bonus disabled for $user\003"
} else {
putlog "There was an error while changing irc status($irc_idle) for user $user"
}
}
proc user_check { user } {
global db conf
if { $user == "c00kie" } {
return 0
}
set token [::http::geturl $conf(site_url)?key=$conf(key)&do=check&username=$user]
set is_user [::http::data $token]
if { $is_user == 1 } {
putserv "mode $conf(chan) +v $user"
} else {
putquick "PRIVMSG $user : This is only for $conf(site) members! Use your site username!"
putserv "kick $conf(chan) $user : Not a $conf(site) member ! Use your site username!"
}
return $is_user
}
proc hello { nick } {
global gfile conf
set h [open "$gfile" "r"]
set greet [read $h]
regsub -all "%nick" $greet "$nick" greet
regsub -all "%chan" $greet "$conf(chan)" greet
foreach line [split $greet "|"] {
putquick "NOTICE $nick : $line"
}
}
putlog "putyn's idle,greet,usercheck scripts loaded!"