To control spam in part, you only have to put +u mode in your channel.
This prevents custom messages are displayed on the quit or part event.
But if you still want that code, study identifiers $regex and $regml, they allow you to more accurately detect URLs in messages. See this Wiki

Also, put the channel in moderate mode after a user part with spam, you may not be as convenient.
Because every time it happens this event, you'd be putting your channel moderate way, and thus mutes users who have no voice or arroba.
Think about it.

Last edited by JuanAm; 18/12/14 02:26 AM.