시작하려면 어디에서나 대답을 찾을 수 없습니다. 임포트 할 필요가있는 코드인지 아니면 제대로 수행되지 않은 코드인지 확실하지 않습니다. 너트 셸에서이 프로젝트를 통해 SMS 메시지로 더 나은 트 위치 팔로워 알리미를 만드는 방법과 다른 많은 것들이 있습니다.TypeError : 버퍼 인터페이스를 지원하지 않습니다. Twitch IRC Chat Bot
편집 : 다음과 같이 전체 충돌 로그는 다음과 같습니다
line 16 in <module>
irc.send('PASS ' + password + '\r\n')
TypeError: Does not support the buffer interface
을 또한, 나는이를 얻을 수있는 파일을 클릭 반복적으로 두 번에 한을, 그래서 미안의 경우 조금 떨어져. 코드 크래시 로그를 작동시키지 못했습니다.
import socket #imports module allowing connection to IRC
import threading #imports module allowing timing functions
bot_owner = 'BetterFollowerBot'
nick = 'BetterFollowerBot'
channel = '#BetterFollowerBot'
server = 'irc.twitch.tv'
password = '~Took This Out~'
queue = 0 #sets variable for anti-spam queue functionality
irc = socket.socket()
irc.connect((server, 6667)) #connects to the server
#sends variables for connection to twitch chat
irc.send('PASS ' + password + '\r\n')
irc.send('USER ' + nick + ' 0 * :' + bot_owner + '\r\n')
irc.send('NICK ' + nick + '\r\n')
irc.send('JOIN ' + channel + '\r\n')
def message(msg): #function for sending messages to the IRC chat
global queue
queue = queue + 1
print (queue)
if queue < 20: #ensures does not send >20 msgs per 30 seconds.
irc.send('PRIVMSG ' + channel + ' :' + msg + '\r\n')
else:
print ('Message deleted')
def queuetimer(): #function for resetting the queue every 30 seconds
global queue
print ('queue reset')
queue = 0
threading.Timer(30,queuetimer).start()
queuetimer()
while True:
data = irc.recv(1204) #gets output from IRC server
user = data.split(':')[1]
user = user.split('!')[0] #determines the sender of the messages
print (data)
if data.find('PING') != -1:
irc.send(data.replace('PING', 'PONG')) #responds to PINGS from the server
if data.find('!test') != -1: #!test command
message('Hi')
가있는 라인 오류를 얻고있다, 당신은 전체 역 추적을 붙여 넣을 수 있을까? – Roberto
예. 할 수 있습니다. 지금 추가 – EduCodes
편집을 추가했습니다. – EduCodes