The two most basic channel related tasks are joining and parting a channel. The commands are “JOIN” and “PART” and look like this:
No surprises there. Let's put it into Python code:
Getting and setting the topic is also pretty simple. The same command, “TOPIC”, is used for both operations. Here is how to get and set a topic, in the respective order:
Our topic should not actually retrieve the data, though. Instead, the recv and retrieve methods should catch it, so creating a method to “get” and set the topic should be pretty simple.
To get a list of names of everyone in a given channel, the “NAMES” command is used:
The Python version is short and sweet:
IRC allows people to invite their friends to a certain channel using the “INVITE” command:
Let's create an invite method:
Setting a channel's mode is done with the “MODE” command:
Sometimes, a user must be specified:
To make that a bit more clear, here's an example:
The above command would give “Peyton” operator status in a channel. Let's create a mode method:
If you have operator status in a channel, you may kick a user from the channel:
A reason can also be specified:
Here's the Python way:
blog comments powered by Disqus |