2016-06-16 2 views
1
local Bot = { 
    Channel = "#*twitch_channel*", 
    Name = "smmchrisbot", 
    Pass = "oauth:*code*", 
    Server = "irc.chat.twitch.tv", 
    Port = 6667 
} 

local socket = require("socket") 

local client,err = socket.tcp() 
if not client then 
    error(err) 
end 

Bot.Client = client 

function Bot.Pingpong(self) 
    print("Fire") --Does print 
    local msg = Bot.Client:receive("*l") --Doesn't get anthing? 
    print(msg) 
    if msg == "PING :tmi.twitch.tv" then 
     Bot.Client:send("PONG :tmi.twitch.tv") 
    end 
end 

--function Bot.Chat(self,msg) 
--Bot.Client:send("PRIVMSG "..Channel.." :"..msg.."\r\n\r\n") 
--end 

Bot.Client:settimeout(1) 

Bot.Client:connect(Bot.Server, Bot.Port) 

Bot:Pingpong() 
Bot.Client:send("PASS "..Bot.Pass) 
Bot:Pingpong() 
Bot.Client:send("NICK "..Bot.Name) 
Bot:Pingpong() 
Bot.Client:send("JOIN "..Bot.Channel) 

while true do 
    Bot:Pingpong() 
    sleep(1) 
    --Bot:Chat(io.read()) 
end 

"불"을 인쇄 한 다음 계속 반복하지 않습니다. 왜 그런지 알아?루아 소켓 irc twitch 봇이 핑하지 못합니까?

+0

나는 무엇이 잘못되었는지 전혀 모른다 ... – warspyking

답변

0

대답은 실제로 쉽습니다! 방금 암호를 연결하고 "\ r \ n"을 연결해야했습니다.