archive- Random tools & helpful resources for IRC |
git clone git://git.acid.vegas/archive.git |
Log | Files | Refs | Archive |
banner.pl (4674B)
1 use strict; 2 use warnings; 3 no strict 'subs'; 4 5 my $SCRIPT_NAME = 'banner'; 6 my $SCRIPT_AUTHOR = 'The Krusty Krab <wowaname@volatile.ch>'; 7 my $SCRIPT_VERSION = '1.0'; 8 my $SCRIPT_LICENCE = 'Public domain'; 9 my $SCRIPT_DESC = 'Banner text'; 10 our (%queue, %timer); 11 12 if (weechat::register($SCRIPT_NAME, $SCRIPT_AUTHOR, $SCRIPT_VERSION, 13 $SCRIPT_LICENCE, $SCRIPT_DESC, '', '')) { 14 weechat::hook_command('banner', 'Banner text', 15 "[-nick|-key|-limit] text", 16 "-nick: send to /nick command\n". 17 "-key: send as /mode +k (doesn't work on all ircds)\n". 18 "-limit: send as /mode +l\n", 19 '', 'cmd_banner', ''); 20 } 21 22 sub cmd_banner 23 { 24 my ($buffer, $cmd) = ($_[1], $_[2]); 25 my ($flag, $text) = $cmd =~ /^(-nick|-key|-limit|) *(.*)$/; 26 my @output; 27 my $prefix = '/msg *'; 28 my $nick = weechat::info_get('irc_nick', 29 weechat::buffer_get_string($buffer, 'localvar_server')); 30 31 my @chars = ('````````^', 32 'XX``XXXXX', 33 '``````XXX 34 ````````` 35 ``````XXX', 36 '``X```X`` 37 XXXXXXXXX 38 ``X```X`` 39 XXXXXXXXX 40 ``X```X``', 41 '`````XX`` 42 `X``X``X` 43 XX``X``XX 44 `X``X``X` 45 ``XX`````', 46 '```X```XX 47 XX``X``XX 48 XX```X```', 49 '```X`X``` 50 X`X`X`X`X 51 ``X```X``', 52 '``````XXX', 53 '`XXXXXXX` 54 X```````X', 55 'X```````X 56 `XXXXXXX`', 57 '``````X`X 58 ```````X` 59 ``````X`X', 60 '````X```` 61 ```XXX``` 62 ````X````', 63 'X```````` 64 `XX``````', 65 '````X```^ 66 ````X````', 67 'X````````', 68 'XXX`````` 69 ```XXX``` 70 ``````XXX', 71 '`XXXXXXX` 72 X```````X 73 `XXXXXXX`', 74 'X``````X` 75 XXXXXXXXX 76 X````````', 77 'XXX````X` 78 X``XX```X 79 X````XXX`', 80 '`X`````X` 81 X```X```X 82 `XXX`XXX`', 83 '````XXX`` 84 ````X``X` 85 XXXXXXXXX', 86 'X```XXXXX 87 X```X```X 88 `XXX````X', 89 '`XXXXXXX` 90 X```X```X 91 `XXX`````', 92 'XXX`````X 93 ```XXX``X 94 ``````XXX', 95 '`XXX`XXX` 96 X```X```X 97 `XXX`XXX`', 98 '`````XXX` 99 X```X```X 100 `XXXXXXX`', 101 '``XX`XX``', 102 '`X``````` 103 ``XX`XX``', 104 '````X```` 105 ```X`X``` 106 ``X```X``', 107 '```X`X``` 108 ```X`X``^ 109 ```X`X```', 110 '``X```X`` 111 ```X`X``` 112 ````X````', 113 '```````X` 114 XX``X```X 115 `````XXX`', 116 '`XXXXXXX` 117 X``XXX``X 118 X`X```X`X 119 X`XXXXXXX', 120 'XXXXXXXX` 121 ````X```X 122 XXXXXXXX`', 123 'XXXXXXXXX 124 X```X```X 125 `XXX`XXX`', 126 '`XXXXXXX` 127 X```````X 128 `X`````X`', 129 'XXXXXXXXX 130 X```````X 131 `XXXXXXX`', 132 'XXXXXXXXX 133 X```X```X 134 X```````X', 135 'XXXXXXXXX 136 ````X```X 137 ````````X', 138 '`XXXXXXX` 139 X```````X 140 `XXX```X`', 141 'XXXXXXXXX 142 ````X```` 143 XXXXXXXXX', 144 'X```````X 145 XXXXXXXXX 146 X```````X', 147 '`X``````X 148 X```````X 149 `XXXXXXXX', 150 'XXXXXXXXX 151 ````X```` 152 ```X`X``` 153 XXX```XXX', 154 'XXXXXXXXX 155 X````````', 156 'XXXXXXXXX 157 ``````XX` 158 ``XXXX``` 159 ``````XX` 160 XXXXXXXXX', 161 'XXXXXXXXX 162 ``````XX` 163 ```XXX``` 164 `XX`````` 165 XXXXXXXXX', 166 'XXXXXXXXX 167 X```````X 168 XXXXXXXXX', 169 'XXXXXXXXX 170 ````X```X 171 `````XXX`', 172 '`XXXXXXXX 173 XX``````X 174 XXXXXXXXX 175 X````````', 176 'XXXXXXXXX 177 ````X```X 178 XXXX`XXX`', 179 '`X```XXX` 180 X```X```X 181 `XXX```X`', 182 '````````X 183 XXXXXXXXX 184 ````````X', 185 'XXXXXXXXX 186 X```````` 187 XXXXXXXXX', 188 '```XXXXXX 189 XXX`````` 190 ```XXXXXX', 191 '`XXXXXXXX 192 X```````` 193 `XXXX```` 194 X```````` 195 `XXXXXXXX', 196 'XXX```XXX 197 ```XXX``` 198 XXX```XXX', 199 '`````XXXX 200 XXXXX```` 201 `````XXXX', 202 'XXX`````X 203 X``XXX``X 204 X`````XXX', 205 'XXXXXXXXX 206 X```````X', 207 '``````XXX 208 ```XXX``` 209 XXX``````', 210 'X```````X 211 XXXXXXXXX', 212 '```````X` 213 ````````X 214 ```````X`', 215 'X```````` 216 X```````^ 217 X````````', 218 '````````X 219 ```````X`', 220 '`X``X```` 221 X`X`X```` 222 XXXX`````', 223 'XXXXXXXXX 224 X```X```` 225 `XXX`````', 226 '`XXX````` 227 X```X```` 228 X```X````', 229 '`XXX````` 230 X```X```` 231 XXXXXXXXX', 232 '`XXX````` 233 X`X`X```` 234 X`XX`````', 235 'XXXXXXXX` 236 ````X```X', 237 'X``X````` 238 X`X`X```` 239 `XXXX````', 240 'XXXXXXXXX 241 ````X```` 242 XXXX`````', 243 'XXXXX``X`', 244 'X```````` 245 `XXXX``X`', 246 'XXXXXXXXX 247 ````X```` 248 XXXX`X```', 249 'X```````X 250 XXXXXXXXX 251 X````````', 252 'XXXXX```` 253 ````X```` 254 XXXX````` 255 ````X```` 256 XXXX`````', 257 'XXXXX```` 258 ````X```` 259 XXXX`````', 260 'XXXXX```` 261 X```X```` 262 XXXXX````', 263 'XXXXX```` 264 `X``X```` 265 ``XX`````', 266 '``XX````` 267 `X``X```` 268 XXXXX````', 269 'XXXXX```` 270 ````X````', 271 'X``X````` 272 X`X`X```` 273 `X``X````', 274 '`XXXXXXX` 275 X```X````', 276 '`XXXX```` 277 X```````` 278 XXXXX````', 279 '``XXX```` 280 XX``````` 281 ``XXX````', 282 '`XXXX```` 283 X```````` 284 `XXX````` 285 X```````` 286 `XXXX````', 287 'XX`XX```` 288 ``X`````` 289 XX`XX````', 290 'X``XX```` 291 X`X`````` 292 `XXXX````', 293 'XX``X```` 294 X`X`X```` 295 X``XX````', 296 '````X```` 297 XXXX`XXXX 298 X```````X', 299 'XXXXXXXXX', 300 'X```````X 301 XXXX`XXXX 302 ````X````', 303 ' ```````X` 304 ````````X 305 ```````X` 306 ````````X'); 307 308 for ($flag) { 309 /-nick/ and $prefix = '/nick', last; 310 /-key/ and $prefix = '/mode +k', last; 311 /-limit/ and $prefix = '/mode +l', last; 312 } 313 314 if ($flag eq '-limit') { $chars[$_] =~ y/`X/18/ for (0 .. (@chars - 1)) } 315 316 for my $char (split //, $text) { 317 push @output, $flag eq '-limit' ? '111111111' : '`````````'; 318 push @output, split /\n/, $chars[ord($char) - 0x20]; 319 } 320 321 weechat::command($buffer, "$prefix $_") for @output; 322 323 for ($flag) { 324 /-nick/ and weechat::command($buffer, "/nick $nick"), last; 325 /-key/ and weechat::command($buffer, "/mode +k `````````"), 326 weechat::command($buffer, "/mode -k `````````"), 327 last; 328 /-limit/ and weechat::command($buffer, "/mode -l"), last; 329 } 330 331 return weechat::WEECHAT_RC_OK; 332 }