In case you need to see what time it is according to the server, you can use the time method. You simply call it, passing no arguments: ... The server replies with a “391” message. By looking through the list I gave you earlier, you will find that this equates to the “time” code. If we need to know the administrator of a certain server, we can use the admin method. It simply sends an “ADMIN” command to the server, and the server sends back the appropriate information. The admin method takes no arguments: ... We can get more information about the server by using the “INFO” command, which is called by the corresponding method, info. Like the admin method, the info method takes no arguments: ... The message of the day may be retreived using the motd method: ... A list of channels might prove extremely useful to your application. For example, let's say your application needed to join channels with over 20 users, or let's say that your application always needed to be in the most popular channel on the network. The list method may be used, which issues the “LIST” command to the server, and the server's response can be caught by setting handlers for the events “LISTSTART”, “LIST” and “LISTEND”: ... If you need to examine the topic of a channel, you can send a “TOPIC” command with the topic method: ... If you are a channel operator, you may also use the list method to set the topic of a given channel by passing an additional argument to the method: ... Similarly, the modes of a channel may be examined by using the mode method. The method may also be used to examine user methods: ... If you wish to set a mode, the same method is used along with an additional argument: ... You may want to create an application that is responsible for controlling a channel. For example, let's say you wanted to kick users who sent too many messages to the channel too quickly. The kick method is used for this: ... It might also be a good idea to leave a reason for kicking the user: ... If your application needs a lot of power to operate, you can log on as an IRC operator: ... You can also send a raw string to the server using the send_raw method. It takes one argument, which is the string you want to send: ...
blog comments powered by Disqus |
|
|
|
|
|
|
|