err not ptokax bound but its lua
 

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

err not ptokax bound but its lua

Started by DoJIN, 05 January, 2004, 17:14:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DoJIN

hey  im testing the lua integration for my client

i need a lua script that executes  a ban command when some1 advertises in main chat

so as example some1 says:

<[TUC]?Niederweit>bla.no-ip.com

it will respond with

+pban [TUC] Niederweit Advertisement is forbidden

can this be done? and who is willing to create it

plop

try the search button from this forum.
there are a couple diferent versions of these scripts.
some ban, some kick and my sneaky anti advertising replaces the url for your own hub url.

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 <----<<

DoJIN

#2
thats just it
  the scripts isnt server bound   but client bound

i can run lua scripts on my dc client   the hub is in perl but  the hub owner is very busy with other scripts for the hub

and all scripts here kick or ban the user as an server command   i want it to be as an chat command   he have troubles with addy spammers in the hub laley

SaintSinner

how can you run lua scripts on your client,...
what client are you using?
   


DoJIN

.pdc++

it will run the script if its called  startup.lua   ( works on more clients)

plop

bcdc++ 305a also does it.
haven't checked it good, so don't know it it can capture mainchat events.
would any1 know a manual about these clients scripting interface ???

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 <----<<

DoJIN

i think i can get an clientside triggerbot scriptje
but im not sure
ill ask aroud

DoJIN

#7
ghmmm  he isnt sure if hes allowed to give me the script   cuz he didnt create it  


but

i found this in the source of my client

if dcpp == nill then dcpp = { } end
if clients == nil then clients = { } end

function OnCommandEnter(mess)
   -- macros and such can be used here, but not practically until I remove next comment :p
   -- returning true here will at some point prevent DC++ from further processing it.
end

function OnTimer()
   -- Set this up by calling Timer():SetTimer(seconds), Timer():StartTimer(),
   -- and Timer():StopTimer()
end

function OnDownloadComplete(targetname, targetsize)
   frmClient():PrintDebug("Download complete: \"" .. targetname .. "\" is " ..
      targetsize .. " bytes")
end

dcpp.search = function(aClient, search_string)
   -- frmClient():PrintDebug("Search received: " .. search_string)
   return false;
end

dcpp.myinfo = function(aClient, myinfo_nick)
   AddUser(aClient, myinfo_nick)

   return false;
end

dcpp.quit = function(aClient, nick)
   frmClient():PrintDebug("User removed: \"" .. nick .. "\"")
   clients[aClient].ops[nick] = nil
   clients[aClient].users[nick] = nil

   return false;
end

dcpp.hubName = function(aClient, hub_name)
   clients[aClient].name = hub_name
   frmClient():PrintDebug("Received hubname: " .. clients[aClient].name)
end

dcpp.hello = function(aClient, hello_nick)
   -- find out own nick
   if clients[aClient].my_nick == nil then
      -- the first hello send by the server is the nick it accepts from us.
      clients[aClient].my_nick = hello_nick
      frmClient():PrintDebug("Own nick on " .. clients[aClient].name .. " is " .. hello_nick)
   end

   AddUser(aClient, hello_nick)

   return false;
end

dcpp.privateMessage = function(aClient, sender, message)
   frmClient():PrintDebug("PM received from " .. sender .. ": \"" .. message .. "\"")
   if string.find(message, "slot") ~= nil then
      frmClient():SendClientMessage(aClient, "$To: " .. sender .. " From: " ..
         clients[aClient].my_nick .. " $<" .. clients[aClient].my_nick ..
         "> don't ask...|")
   end

   return false;
end

function DataArrival(client, mess)
   -- returning true here will at some point prevent DC++ from further processing it.

   if string.find(mess, "$Search ") == 1 then
      return dcpp.search(client, mess)
   elseif string.find(mess, "$MyINFO $ALL ") == 1 then
      return dcpp.myinfo(client, string.sub(mess, 14, string.find(mess, " ", 14) - 1))
   elseif string.find(mess, "$Quit ") == 1 then
      return dcpp.quit(client, string.sub(mess, 7, -1))
   elseif string.find(mess, "$HubName ") then
      return dcpp.hubName(client, string.sub(mess, 10, -1))
   elseif string.find(mess, "$Hello ") == 1 then
      return dcpp.hello(client, string.sub(mess, 8, -1))
   elseif string.find(mess, "$OpList ") == 1 then
      for op in string.gfind(string.sub(mess, 9, -1), "[^$]+") do AddOp(client, op) end
   elseif string.find(mess, "$To: ") == 1 then
      local fromNick = string.sub(mess, string.find(mess, "From: ") + 6, -1)
      local sepPos = string.find(fromNick, " %$")
      local message = string.sub(fromNick, sepPos + 2, -1)
      fromNick = string.sub(fromNick, 1, sepPos - 1)
      return dcpp.privateMessage(client, fromNick, message)
   end
end

function SendActiveSearchResult(aClient, IP_port, search_nick, filename, filesize, open_slots, total_slots)
   frmClient():SendUDP(IP_port, "$SR " .. search_nick .. " " .. filename ..
      "\005" .. filesize .. " " .. open_slots .. "/" .. total_slots ..
      "\005" .. clients[aClient].name .. " (" .. clients[aClient].ipPort .. ")|")
end




is this of some help?

plop

thats nearly the same as bcdc++.
got some other things 2 make 1st but i'll try 2 build something in or before the weekend.

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 <----<<

DoJIN

i just red this :

QuoteOriginally posted by plop
thats nearly the same as bcdc++.
got some other things 2 make 1st but i'll try 2 build something in or before the weekend

build in where?

plop

QuoteOriginally posted by DoJIN
i just red this :

QuoteOriginally posted by plop
thats nearly the same as bcdc++.
got some other things 2 make 1st but i'll try 2 build something in or before the weekend

build in where?
got some other things 2 make 1st but i'll try 2 build something.
in or before the weekend.
maby this is more clear. lol
should have been a , between something and in.

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 <----<<

DoJIN

soz now i c my bad :s

DoJIN

hey    Plop hows the script going ?

plop

QuoteOriginally posted by DoJIN
hey    Plop hows the script going ?
bit short on time but it's getting there, won't stop before it works. lol

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 <----<<

DoJIN

hehe  is it fun to do something different then ptokax scripting  for once?

plop

QuoteOriginally posted by DoJIN
hehe  is it fun to do something different then ptokax scripting  for once?
same thing. lol
also use it for generating interactive website's so my bot can show realtime webstats from the hub.
but this is a bit on ice.

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 <----<<

DoJIN

#16
well  ive got it

plop tnx   but i get an sytax error:
script1.lua:38: attempt to index global `hub' (a nil value)


heres the code :

-----------------------------------------------------------------------------------------------------------

-- Originally Written by ???
-- ReWritten by BlazeXxX
-- Requested by DoJiN
-- ReWritten to be ran on a dc++ client by plop


-- these are bot names it shouldn't send the slot response 2
DONT = { ["HubWatcher"]=1,}

-- the kick/ban reason which the user in question gets
Reason = "has been kicked because of Offensive Language / Advertising."

-- the command you want 2 trigger
DoCommand = "+lban"

-- replace this with the botname
botname = "HubWatcher"

-- the array of forbidden things
trigs = { "fuck", "weingarten","ip.com","ass.org","dns2go","yhub","servemp3.net","mine.nu"}

   hub.onPrivateMessage = function( this, user, to, prefix, text )
      DC():PrintDebug( this:getHubName().."> Priv msg: "..user:getNick().." -> "..to.." = "..text )
       
      if not user:isOp() and not user:msgHandled( "slots" ) then
         local s = string.lower( text )
         if string.find( s, "[^a-z]slots?[^a-z]" ) then
            user:sendPrivMsgFmt( "regarding slots: if you want something _rare_ (NOT ".."something _new_), please specify what")
            DC():PrintDebug( this:getHubName().."> Sent 'slots' reply to: "..user:getNick() )
            user:setMsgHandled( "slots" )
         else
            for i=1,table.getn(trigs) do
               if string.find(s, trigs) then
                  local ownNick = this:getOwnNick()
                  DC():SendHubMessage( this:getId(), "<"..ownNick.."> +pban "..user:getNick().." You have been kicked because of Offensive Language / Advertising.|" )
                  break
               end
            end
         end
      end
   end

VidFamne

Dont you have to declare the table  "hub" somewhwere?
Like hub = {}

DoJIN

ive got no clue  plop made it on my request

he told me it worked for him we both use the same client to run the script on

there was 1 thing tho :

seems 2 be a problem still, as it shouldn't kick OP's ( not user:isOp() ), but that fails 2 do what it should do.
anyway enjoy the script and i hope it works (worked for me @ least).

plop

DoJIN

hmm  ive been fooling arouns a bit  

does some1 know how i can get  the nick of the person who says one of the forbidden words?

plop

QuoteOriginally posted by VidFamne
Dont you have to declare the table  "hub" somewhwere?
Like hub = {}
the script has 2 be inserted in the startup.lua file shipped with bcdc++/phantomdc.
in that part you'll find the table called hub.
but this 1 only works on 0.305.
everything changed on 0.306 as they are still developing the scripting interface.
here is the version for 0.306 clients.
insert this @ the top of the startup.lua file.
-- the array of forbidden things
trigs = { "fuck", "weingarten","ip.com","ass.org","dns2go","yhub","servemp3.net","mine,nu"}
and replace this function/part.
  hub.onPrivateMessage = function( this, user, to, prefix, text )
      DC():PrintDebug( this:getHubName().."> Priv msg: "..user:getNick().." -> "..to.." = "..text )
      
      if not user:isOp() and not user:msgHandled( "slots" ) then
         local s = string.lower( text )
         if string.find( s, "[^a-z]slots?[^a-z]" ) then
            user:sendPrivMsgFmt( "regarding slots: if you want something _rare_ (NOT ".."something _new_), please specify what")
            DC():PrintDebug( this:getHubName().."> Sent 'slots' reply to: "..user:getNick() )
            user:setMsgHandled( "slots" )
         else
            for i=1,table.getn(trigs) do
               if string.find(s, trigs[i]) then
                  local ownNick = this:getOwnNick()
                  DC():SendHubMessage( this:getId(), "<"..ownNick.."> !kickuser "..user:getNick().." You have been kicked because of Offensive Language / Advertising.|" )
                  break
               end
            end
         end
      end
   end
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 <----<<

plop

QuoteOriginally posted by DoJIN
hmm  ive been fooling arouns a bit  

does some1 know how i can get  the nick of the person who says one of the forbidden words?
with this.
user:getNick()

unlike on ptokax on bcdc++/phantomdc everything is done by the script.

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 <----<<

DoJIN

yeah  that was what ive been loookin for  tnx

SMF spam blocked by CleanTalk