Skip to content

Use sockets to attempt to join an irc channel and talk with a bot

License

Notifications You must be signed in to change notification settings

FHArchive/Python.IRCBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Github top language Codacy grade Codacy coverage Repository size Issues License Commit activity Last commit

Python.IRCBot

Project Icon

Use sockets to attempt to join an IRC channel and talk with a bot

Download

Clone

Using The Command Line

  1. Press the Clone or download button in the top right
  2. Copy the URL (link)
  3. Open the command line and change directory to where you wish to clone to
  4. Type 'git clone' followed by URL in step 2
$ git clone https://github.com/[user-name]/[repository]

More information can be found at https://help.github.com/en/articles/cloning-a-repository

Using GitHub Desktop

  1. Press the Clone or download button in the top right
  2. Click open in desktop
  3. Choose the path for where you want and click Clone

More information can be found at https://help.github.com/en/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktop

Download Zip File

  1. Download this GitHub repository
  2. Extract the zip archive
  3. Copy/ move to the desired location

Language information

Built for

This program has been written for Python 3 and has been tested with Python version 3.7.0 https://www.python.org/downloads/release/python-370/ on a Windows 10 PC.

Other versions

To install Python, go to https://www.python.org/ and download the latest version.

How to run

  1. Open the .py file in IDLE
  2. Run by pressing F5 or by selecting Run> Run Module

What this program does

  • Read configuration data from a json file ('data.json'). In the form:
{
"host_url": "irc.hostname.org",
"protocol": "IRC",
"port": 6667,
"irc_channel": "#channel",
"bot_name": "bot_name",
"user_name": "user_name",
"user_password": "user_password"
}
  • Gets a message in its raw from
getRawMessage()
  • Takes a raw message and refines it (name, message)
getRefinedMessage(messageData)
  • Starts an IRC connection, signs in and goes to the desired channel
  • Ignore the welcome messages

Add your own application code

You can add code to talk to the target bot deal with any responses and deal with them appropriately. For instance you may want to implement a 'chatbot' or answer challenge questions (in the case of root-me)

Example code

Send a private message to our target bot

irc.send(bytes("PRIVMSG "+ bot_name +" :"+ "my message here" +"\n", "UTF-8"))

Get a message from the bot

messageData = getRawMessage()
if (DEBUG):
    print(messageData)
name, message = getRefinedMessage(messageData)
print(name, message)

Licence

MIT License Copyright (c) fredhappyface (See the LICENSE for more information.)

About

Use sockets to attempt to join an irc channel and talk with a bot

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages