Word script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Word script

Started by Twix, 27 November, 2003, 13:14:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Twix

I'm after a script, or part of a script that I can use that will warn and then kick a user who mentions a word either in main chat or a PM.

Any ideas?

TIA

Twix

kepp

#1
sBot = "BotName_here"

BadWords = {["fuck"]=1,["dick"]=2,["pussy"]=3}

               function Main()
               frmHub:RegBot(sBot)
end

              function DataArrival(user, data)
                       if not user.bOperator then
                       for key,a in BadWords do
                       if strfind(strlower(data), key, 1, 1) or strfind(strlower(data), key, 1, 4) then
                      user:SendData(BotName, "Do Not missbehave in here")
                      --SendToAll(BotName, ""..user.sName.." has been kicked due to Misbehave")
                      user:Disconnect()
               end
          end
     end
end

Just a quick one... Not tested!

*Edit* Oups... some changes :)
Guarding    

chub

Good one Kepp, it sure silenced me. Didn't think anything could gag the hubowner. LOL.

I felt I had to try it since there are a lot of ppl comming into the hub screaming things about the hub "theme" and kinda wanted the worse most common stuff out of the hub as fast as possible. Well, turned out the script  disconnected the user sending abusing posts to main chat but also totally gagged me (owner/host) So except for the owner gag it is a nice script.  :D

plop

lol, it gags all operators.
kepp: you want 2 check if a user is not a operator, if it is a operator you don't want 2 do anything.
return 1  means stop processing and stop any further data going out.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

Sorry about that... :D

Updated ***
Guarding    

chub

#5
Ok, since I am at work atm, I can't test it, but have a question: Is it possible to have phrases in it and not just words? Like ["a phrase instead of one word"]=1 ?
Also, I assume the limit is not only 3 words?  :D

kepp

Nope, but i can't think of any other words that i care about...

Hmm, and nope, well, i can't do it....
i think it will search for spaces between eachword...
and the user will get kicked for saying nothing at all...
But then again, i don't know for sure
Guarding    

plop

posible, but for safety you better replace spaces for %s.
["a%sphrase%sinstead%sof%sone%sword"]=1
like this.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

chub

QuoteOriginally posted by plop
posible, but for safety you better replace spaces for %s.
["a%sphrase%sinstead%sof%sone%sword"]=1
like this.

plop
Thanks plop, if that works, u may have solved one of my biggest problems, hubwise. Will test it when I get home from work in 6 hours or so and report back here  8)

Twix

#9
Thanks kepp, just what I was after  :D

chub

well... works fine after some modding...  :D

kepp

np... And thanks Plop!!!
Guarding    

plop

http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

tezlo

few things..
    [*]no need for an associative array.. you iterate them all anyway
    [*]you only need to strlower(data) once
    [*]%s will NOT work since the strfind is not regexp enabled
    [*]this code will try to find badwords not only on chat and PM..
    but on Search or anything coming to DataArrival
    [*]whats the point of censoring PMs anyway?
    [/list]

    badWords = { "fuck", "dick", "pussy", "my ass" }
    
    function DataArrival(user, data)
    	if not user.bOperator and (strsub(data, 1, 1) == "<" or strsub(data, 1, 4) == "$To:") then
    		data = strlower(data)	-- !!
    		for id, word in badWords do
    			if strfind(data, word, 1, 1) then
    				-- do whatever
    			end
    		end
    	end
    end
    

    kepp

    #14
    Some copy and paste misstakes, as i wrote it for something else..
    yep, true, Pm's are private so who care about a bad word in there?

    badWords = { "fuck", "dick", "pussy", "my ass" }
    
    function DataArrival(user, data)
    	if not user.bOperator and (strsub(data, 1, 1) == "<") then
    		data = strlower(data)	-- !!
    		for id, word in badWords do
    			if strfind(data, word, 1, 1) then
    				-- do whatever
    			end
    		end
    	end
    end
    
    Guarding    

    chub

    #15
    QuoteOriginally posted by tezlo
    few things..
      [*]no need for an associative array.. you iterate them all anyway
      [*]you only need to strlower(data) once
      [*]%s will NOT work since the strfind is not regexp enabled
      [*]this code will try to find badwords not only on chat and PM..
      but on Search or anything coming to DataArrival
      [*]whats the point of censoring PMs anyway?
      [/list]



      What's the point of censoring PMs? I gather most ppl here know I host a gaythemed hub, by now. And there are ppl popping in just to vent their narrowminded thoughts of almost any outlook on life so for instance this, I got in a PM, the other day:
      [2003-11-24 23:36] <[Telia]Sphinxx> YOU ARE SICK!!!! A FUCKING PERVERT!! 
      [2003-11-24 23:36]  (automated message) I am not around the computer. Please leave me a note or ask someone else!    
      

      This happy guy rambled on in main chat aswell and I got notified that he'd been on others in PM aswell.
      I have rather thick skin after a few years in the "scene" so I don't mind it and frankly don't care, either, but there are ppl much less secure than me and things like this posted to them are kinda hurtful.
      I want to be able to filter out as much of this kind of stuff as possible, in main and in PM.

      Reason enough?

      kepp

      #16
      *** <---
      Guarding    

      chub

      QuoteOriginally posted by kepp
      *** <---

      LOL... eeh good point!   :D

      kepp

      sorry, i was about to comment something, but noticed i didn't have too :)
      Guarding    

      plop

      more then enough reason 2 do so chub.
      got 2 gay nephew's and had a couple gay teachers.
      some can do like you, others feel the pain from such remarks.
      it's sad that there are such narrow minded ppl around.
      it's everybody's free right 2 love who he/she wants whether it's from the same sex or not.
      if some1 can't except that he/she has a problem him-/herself.

      plop
      http://www.plop.nl lua scripts/howto\'s.
      http://www.thegoldenangel.net
      http://www.vikingshub.com
      http://www.lua.org

      >>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

      kepp

      Guarding    

      chub

      QuoteOriginally posted by plop

      it's sad that there are such narrow minded ppl around.
      it's everybody's free right 2 love who he/she wants whether it's from the same sex or not.
      if some1 can't except that he/she has a problem him-/herself.

      plop
      Couldn't agree more.

      Anyhow, I am running the script in the hub and it seems to be working grand ok. Adding more phrases to it when I find new word combos that these ppl use.

      SMF spam blocked by CleanTalk