How to receive files on a channel with a python bot? reddit / irc ---------------------------------------------------------------------- 4_The_Wolf_X · 2017-09-17 09:46 Not sure if the fine people here can help me out or if I should take this to the python developers sub? I've created a semi-functional IRC bot in python from the following sample code: import socket import time import random import os def stringToBytes(s): blit = "" for char in s: blit += char return bytes(blit, "UTF-8") server = "irc.irchighway.net" # settings channel = "#ebooks" botnick = "NoobBot" irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # defines the socket irc.connect((server, 6667)) # connects to the server irc.send(stringToBytes("USER " + botnick + " " + botnick + " " + botnick + " :This is a fun bot!\n")) # user authentication irc.send(stringToBytes("NICK " + botnick + "\n")) # sets nick irc.send(stringToBytes("PRIVMSG nickserv :iNOOPE\r\n")) # auth time.sleep(4) irc.send(stringToBytes("JOIN " + channel + "\n")) # join the channel irc.send(stringToBytes("PRIVMSG #ebooks @search save the cat\r\n")) while 1: # puts it in a loop text = irc.recv(2040) # receive the text text2 = str(text)[2:] text3 = text2.split(":") print(text3) Just as a test, what these does is search for the book "save the cat" in the ebooks channel. It works, and I get the following showing up in my received text log: > ['', 'Search!Search@ihw-4q5hcb.dyn.suddenlink.net NOTICE NoobBot ', '\\x031,9\\x16\\x02<>\\x02\\x16 Your search for > "\\x0312,9save the cat\\x031,9" has been accepted. > Searching...\\r\\n\''] > ['', 'Search!Search@ihw-4q5hcb.dyn.suddenlink.net NOTICE NoobBot ', '\\x031,9\\x16\\x02<>\\x02\\x16 Your search for > "\\x0312,9save the cat\\x031,9" returned 55 matches. Sending results > to you as\\x0312 SearchBot_results_for_ save the cat.txt.zip\\x031,9. > Search took 0.33 seconds.\\r\\n\''] > ['', 'Search!Search@ihw-4q5hcb.dyn.suddenlink.net NOTICE NoobBot ', 'DCC Send SearchBot_results_for_ save the cat.txt.zip > (173.80.26.71)\\r\\n', 'Search!Search@ihw-4q5hcb.dyn.suddenlink.net > PRIVMSG NoobBot ', "\\x01DCC SEND > SearchBot_results_for__save_the_cat.txt.zip 2907707975 3107 > 3966\\x01\\r\\n'"] If I were running this in mIRC, I would be able to click the link to download the file, however I don't see the link to the actual file anywhere in this text. I'm new to IRC bots, so an example would be helpful. I basically am just trying to make my own small client in python so that I can input searches and the client will download the resulting search text file when it's sent. Any help is really appreciated ---------------------------------------------------------------------- AspiringExpat · 2017-10-01 01:19 Hey man - commented on your post on stack overflow and it got deleted, but I'm working on the same exact program, in the exact same IRC chatroom. I've gotten everything but receiving the epub file nailed down... we should colab mate. I know it has to do with the DCC file transfer protocol, and I've found a few python tutorials on that - but havent been able to get it implemented... ---------------------------------------------------------------------- 4_The_Wolf_X · 2017-10-05 00:06 Hey man! Sure, I'm totally down with collaborating, though I haven't made any progress since, haha, so I don't know that I'll be much help until some solution for receiving the epub (or rar or whatever) comes to light. Edit: Btw, I never even succeeded in downloading the .txt file with the list of epubs. I don't have time to dive into it myself at the moment, but this stuff about bot "packets" might be promising: https:/ /en.wikibooks.org/wiki/Downloading_Files_from_IRC/XDCC_Bot_Guide ---------------------------------------------------------------------- peskypotato · 2018-03-16 01:07 Hello, stuck at the same stage. I have found the irc library for python and [this](https://github.com/jaraco/irc/blob/master/scripts/dc creceive.py) seems to do what we want. However, I am still unable to get it to work. Have you had any success?