@@ -5584,59 +5584,6 @@ bot.addCommand({
5584
5584
5585
5585
} ) ( ) ;
5586
5586
5587
- ;
5588
- IO . register ( 'rawinput' , function spamDetection ( msgObj ) {
5589
- //ignore it if it's not a new message
5590
- if ( msgObj . event_type !== 1 || msgObj . room_id !== bot . adapter . roomid ) {
5591
- return ;
5592
- }
5593
-
5594
- var usrid = msgObj . user_id ,
5595
- message = IO . decodehtmlEntities ( msgObj . content ) ;
5596
-
5597
- //there is a heavy assumption that all users who post a message here have
5598
- // been registered by the bot
5599
- var user = bot . users [ usrid ] ;
5600
- if ( legitMessage ( ) ) {
5601
- return ;
5602
- }
5603
-
5604
- //this is very yucky. we do raw html comparison.
5605
- //shut up...
5606
- var query = '#chat .monologue.user-{0} .content' . supplant ( usrid ) ,
5607
- userMessages = document . querySelectorAll ( query ) ;
5608
-
5609
- var exactMatches = Array . filter ( userMessages , filterMessage ) ;
5610
-
5611
- if ( ! exactMatches . length ) {
5612
- return ;
5613
- }
5614
- bot . log ( exactMatches , message , 'spam detection matches' ) ;
5615
-
5616
- var reply = 'Please don\'t post the same thing more than once in a short ' +
5617
- 'period of time. If it\'s a question, try again in a few hours.' ;
5618
-
5619
- bot . adapter . out . add (
5620
- bot . adapter . reply ( msgObj . user_name ) + " " + reply ,
5621
- msgObj . room_id ) ;
5622
-
5623
- function filterMessage ( content ) {
5624
- var msgid = ( / \d + / ) . exec ( content . parentNode . id ) [ 0 ] ;
5625
- return msgid < msgObj . message_id &&
5626
- content . innerHTML === message ;
5627
- }
5628
- function legitMessage ( ) {
5629
- //since it's still in testing, it should respond to me (Zirak, 617762)
5630
- if ( usrid === 617762 ) {
5631
- return false ;
5632
- }
5633
- //these are the actual filters
5634
- return message . length < 50 &&
5635
- bot . isOwner ( usrid ) ||
5636
- user . reputation > 1000
5637
- }
5638
- } ) ;
5639
-
5640
5587
;
5641
5588
5642
5589
;
0 commit comments