@@ -56,18 +56,9 @@ addEventHandler("onIRCResourceStart",root,
56
56
function (server ,channel ,user ,command ,name ,...)
57
57
if not name then ircNotice (user ," syntax is !ban <name> [reason] (time)" ) return end
58
58
local reason = table.concat ({... }," " ) or " "
59
- local t = split (reason ,40 )
60
- local time
61
- if # t > 1 then
62
- time = " (" .. t [# t ]
63
- end
64
59
local player = getPlayerFromPartialName (name )
65
60
if player then
66
- if time then
67
- addBan (getPlayerIP (player ),nil ,getPlayerSerial (player ),ircGetUserNick (user ),reason ,toMs (time )/ 1000 )
68
- else
69
- addBan (getPlayerIP (player ),nil ,getPlayerSerial (player ),ircGetUserNick (user ),reason )
70
- end
61
+ addBan (getPlayerIP (player ),nil ,getPlayerSerial (player ),ircGetUserNick (user ),reason ,getTimeFromString (reason )/ 1000 )
71
62
else
72
63
ircNotice (user ," '" .. name .. " ' no such player" )
73
64
end
@@ -257,50 +248,23 @@ addEventHandler("onIRCResourceStart",root,
257
248
function (server ,channel ,user ,command ,name ,...)
258
249
if not name then ircNotice (user ," syntax is !banname <name> (<reason>)" ) return end
259
250
local reason = table.concat ({... }," " ) or " "
260
- local t = split (reason ,40 )
261
- local time
262
- if # t > 1 then
263
- time = " (" .. t [# t ]
264
- end
265
- if time then
266
- addBan (nil ,name ,nil ,ircGetUserNick (user ),reason ,toMs (time )/ 1000 )
267
- else
268
- addBan (nil ,name ,nil ,ircGetUserNick (user ),reason )
269
- end
251
+ addBan (nil ,name ,nil ,ircGetUserNick (user ),reason ,getTimeFromString (reason )/ 1000 )
270
252
end
271
253
)
272
254
273
255
addIRCCommandHandler (" !banserial" ,
274
256
function (server ,channel ,user ,command ,serial ,...)
275
257
if not serial then ircNotice (user ," syntax is !banserial <name> (<reason>)" ) return end
276
258
local reason = table.concat ({... }," " ) or " "
277
- local t = split (reason ,40 )
278
- local time
279
- if # t > 1 then
280
- time = " (" .. t [# t ]
281
- end
282
- if time then
283
- addBan (nil ,nil ,serial ,ircGetUserNick (user ),reason ,toMs (time )/ 1000 )
284
- else
285
- addBan (nil ,nil ,serial ,ircGetUserNick (user ),reason )
286
- end
259
+ addBan (nil ,nil ,serial ,ircGetUserNick (user ),reason ,getTimeFromString (reason )/ 1000 )
287
260
end
288
261
)
289
262
290
263
addIRCCommandHandler (" !banip" ,
291
264
function (server ,channel ,user ,command ,ip ,...)
292
265
if not ip then ircNotice (user ," syntax is !banname <name> (<reason>)" ) return end
293
266
local reason = table.concat ({... }," " ) or " "
294
- local t = split (reason ,40 )
295
- local time
296
- if # t > 1 then
297
- time = " (" .. t [# t ]
298
- end
299
- if time then
300
- addBan (ip ,nil ,nil ,ircGetUserNick (user ),reason ,toMs (time )/ 1000 )
301
- else
302
- addBan (ip ,nil ,nil ,ircGetUserNick (user ),reason )
303
- end
267
+ addBan (ip ,nil ,nil ,ircGetUserNick (user ),reason ,getTimeFromString (reason )/ 1000 )
304
268
end
305
269
)
306
270
0 commit comments