Annonymous Private Chat ...yet another chatbot
 

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

Annonymous Private Chat ...yet another chatbot

Started by BottledHate, 22 August, 2004, 21:56:29

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BottledHate

this is pretty fun... log into the private chat bot with a
 new nick.... and  chat away anonymously in the private
chat. Based off of another chatbot that was modded a
bunch of times...

----------------------------------------------------- 
--//Anonymous Chat Bot v1.0 by ?ottledHat? 
--//Formerly know as Chat Bot v3.5 Coded by [aXs] Wellx 01/09-03 
--//Formerly known as the Developer-Chat for TIC50 
--//Based on the idea VIPChat from Piglja
--//Originaly modded on a request from Dj_OcTaGoN.. then changed a lil more to my own liking... :)
--//Users sign in and give a nick which they chat with in a private chat.
----------------------------------------------------- 
saveFile = "Chatters.tbl"
ChatBot = "Hat?-Chat" -- Chat Bot Name 
-----------------------------------------------------
ChatArray={} 
dofile(saveFile)
function NewUserConnected(user)
OpConnected = NewUserConnected
user:SendData("$MyINFO $ALL "..ChatBot.." Anon-Private Chat... +chat  to join +chathelp for cmds$ $PrivateChat9$$999$|")
end
------------------------------------------------------
function DataArrival(user, data) 
   if (strsub(data, 1, 1) == "<" ) then 
      data=strsub(data,1,strlen(data)-1) 
      _,_,cmd=strfind(data, "%b<>%s+(%S+)") 
      local Commands = (DeveloperCommands(user, data, cmd)) 
      return Commands 
   elseif strsub(data, 1, 5) == "$To: " then 
      local s, e, to = strfind(data, "$To: (%S+)") 
      if to ~= ChatBot then 
         return 0 
      else 
         if to == ChatBot then 
            local data=strsub(data,1,strlen(data)-1) 
            local s,e,from,msg = strfind(data,"From:%s+(%S+)%s+$%b<>%s+(.+)") 
            if ChatArray[user.sName] ~= nil then 
               for i,v in ChatArray do 
                  Developer=GetItemByName(i) 
                  if (Developer~=nil) then
                     if i ~= user.sName then 
                        Developer:SendData("$To: "..i.." From: "..ChatBot.." $<"..ChatArray[user.sName].."> "..msg.."|") 
                     end
                  end 
               end 
               return 0
            else 
               user:SendPM(ChatBot,"You do not have permission to chat in here. Type +chat  in the main to join.") 
            end 
            local _,_,cmd = strfind(data,"$%b<>%s+(%S+)") 
            local Commands = (DeveloperCommands(user, data, cmd)) 
         end 
      end 
   end 
end 
------------------------------------------------------
function DeveloperCommands(user, data, cmd) 
   if (cmd == "+chathelp") then 
      user:SendPM(ChatBot,         
         "\r\n\r\n".. 
         "~~ Scripted "..ChatBot.." Commands: ~~\r\n\r\n"..
         " +chat  - Join or Part from the anonymous sub chat room: "..ChatBot.."\r\n"..
         " +showchatters - See witch users that can chat in the "..ChatBot.."\r\n"..
         "\r\n")
      return 1 
   elseif (cmd == "+chat") then
      local s,e,cmd,ChatName = strfind( data, "%b<>%s+(%S+)%s+(.*)" ) 
      if (ChatName == nil) then 
         SendPmToNick(user.sName, ChatBot, "This chat is anonymous. Your message will be received by others as the nickname you enter after the !chat command... Please specify a nick.")
      end 
      if ChatArray[user.sName] == nil then 
         ChatArray[user.sName] = ChatName 
         for index, value in ChatArray do 
            SendPmToNick(index, ChatBot, "**** "..ChatArray[user.sName].." Has joined the "..ChatBot.." ****") 
         end 
         SendPmToNick(user.sName, ChatBot, "\r\nThis chat is anonymous. Your message will be received by others as: <"..ChatArray[user.sName]..">")
      else 
         for index, value in ChatArray do 
            SendPmToNick(index, ChatBot, " "..ChatArray[user.sName].." Has left the "..ChatBot) 
         end 
         ChatArray[user.sName] = nil 
      end 
      SerializeSave(ChatArray, "ChatArray", "") 
      return 1 
   elseif (cmd == "+showchatters") then 
      function DevList() 
         local DevList = "" 
         for k, v in ChatArray do 
            local line = v
            if GetItemByName(k) then 
               if (strlen(k) <= 10) then 
                  DevList = DevList.." ? "..line.."\t\t\t~ On-line ~\r\n" 
               else 
                  DevList = DevList.." ? "..line.."\t\t~ On-line ~\r\n" 
               end 
            else 
               if (strlen(k) <= 10) then 
                  DevList = DevList.." ? "..line.."\t\t\t? Off-Line ?\r\n" 
               else 
                  DevList = DevList.." ? "..line.."\t\t? Off-Line ?\r\n" 
               end 
            end 
         end 
         return DevList 
      end 
      user:SendPM(ChatBot, "\r\n\r\n(? ?.??.-> "..ChatBot.." Chatters <-.??.???) \r\n\r\n"..DevList()) 
      return 1 
   end 
end 
--------------------------------------------------------
function SaveToFile(file,string) 
   local f,e = openfile( file, "w+" )
   if f then
     write(f, string )
     closefile(f)
   end
end 
function SerializeSave(tTable, sTableName, sTab)
   sTab = sTab or "";
   sTmp = ""
   sTmp = sTmp..sTab..sTableName.."={"
   local tStart = 0
	for key, value in tTable do
      if tStart == 1 then
         sTmp = sTmp..",\r\n"
      else
         sTmp = sTmp.."\r\n"
         tStart = 1
      end
      local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
      if(type(value) == "table") then
         sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
      else
         local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
         sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
      end
   end
   sTmp = sTmp.."\r\n"..sTab.."}"
   SaveToFile(saveFile, sTmp) 
end

enjoy...

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

SMF spam blocked by CleanTalk