hi i am trying to connect mirc using below script
import socket
import sys
server = "irc.all4masti.com" #settings
channel = "#all4masti"
botnick = "botname"
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
print ("connecting to:"+server)
irc.connect((server, 6698)) #connects to the server
irc.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :This is a fun bot!\n") #user authentication
irc.send("NICK "+ botnick +"\n") #sets nick
irc.send("PRIVMSG nickserv :iNOOPE\r\n") #auth
irc.send("JOIN "+ channel +"\n") #join the chan
while 1: #puts it in a loop
text=irc.recv(2040) #receive the text
print (text) #print text to console
if text.find('PING') != -1: #check if 'PING' is found
irc.send('PONG ' + text.split() [1] + '\r\n') #returnes 'PONG' back to the server (prevents pinging out!)
but every time it give me error of below
==== RESTART: C:/Users/MaK/OneDrive - Microsoft 365/Desktop/ircflooddeerr.py ===
connecting to:irc.all4masti.com
Traceback (most recent call last):
File "C:/Users/MaK/OneDrive - Microsoft 365/Desktop/ircflooddeerr.py", line 11, in <module>
irc.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :This is a fun bot!\n") #user authentication
TypeError: a bytes-like object is required, not 'str'
While the below is my server link
https://all4masti.com/mibbit/webchat.html?server=irc.all4masti.com:+6698&channel=%23All4Masti&nick=
any suggestion where i am wrong
You need a bytes() to send to server.
Better used format() string. This is how I do.