Viewing topic:Irc bot Commands
Page:
1
16-04-2008 - 18:54
Allright read my code if you give an answer make sure i got the right code in my bot
I need the code to send messeges to the server like
/msg nickserv identify password
when it joins the irc
also i want to give the command
!kick user
and it kick that user
I need the code, im a newbie with irc coding PLEASE HELP!!!
| code | |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
<?php
//Set Username, password, and room here
if ($_POST[nick] == "")
if ($_POST[host] == "")
if ($_POST[room] == "")
if ($_POST[port] ==""){
header("Location: ircbot.html");
exit;
}
$nick = "$_POST[nick]";
$host = "$_POST[host]";
$room = "$_POST[room]";
$port = "$_POST[port]";
// No execution Time limit
set_time_limit(0);
// Opening the socket to the Rizon network
$socket = fsockopen("$host", "$port") or die('Could not connect to the server');
fputs($socket,"USER CMbot combined-minds.net CM :wesbn");
fputs($socket,"NICK $nickn");
// Endless loop until exit.
while(1)
{
// Continue the rest of the script here
while($data = fgets($socket, 128))
{
echo nl2br($data);
flush();
// Separate all data
$ex = explode(' ', $data);
// Respond to PING W/ PONG
if($ex[0] == "PING")
{
fputs($socket, "PONG ".$ex[1]."n");
}
// Join a channel
fputs($socket,"JOIN $roomn");
// Say something in the channel
$command = str_replace(array(chr(10), chr(13)), '', $ex[3]);
switch($command)
{
case ':!how':
if($ex[2] != $nick)
{
$to = $ex[2];
}
else
{
$arr = explode('!', $ex[0]);
$to = ltrim($arr[0],':');
}
fputs($socket, "PRIVMSG $to :Combined-Minds.net irc bot tutorial!n");
break;
case ':!wesbot':
if($ex[2] != $nick)
{
$to = $ex[2];
}
else
{
$arr = explode('!', $ex[0]);
$to = ltrim($arr[0],':');
}
fputs($socket, "PRIVMSG $to :I am a Irc bot made from Php 5 my owner is windows and i am under developement to find out the source code of me email wescooldude3@yahoo.com .n");
break;
case ':!crown':
if($ex[2] != $nick)
{
$to = $ex[2];
}
else
{
$arr = explode('!', $ex[0]);
$to = ltrim($arr[0],':');
}
fputs($socket, "PRIVMSG $to :Hello Crown.n");
break;
case ':!windows':
if($ex[2] != $nick)
{
$to = $ex[2];
}
else
{
$arr = explode('!', $ex[0]);
$to = ltrim($arr[0],':');
}
fputs($socket, "PRIVMSG $to :Hello Master.n");
break;
case ':hey_wesbot':
if($ex[2] != $nick)
{
$to = $ex[2];
}
else
{
$arr = explode('!', $ex[0]);
$to = ltrim($arr[0],':');
}
fputs($socket, "PRIVMSG $to :(O_0)n");
break;
case ':!leave':
fputs($socket,"PRIVMSG ".$ex[2]." No Please dont! (O_0)n");
die('Session ended.');
break;
default:
}
echo '<pre>';
print_r($ex);
echo '</pre>';
}
usleep(100000);
}
?>
|
I need the code to send messeges to the server like
/msg nickserv identify password
when it joins the irc
also i want to give the command
!kick user
and it kick that user
I need the code, im a newbie with irc coding PLEASE HELP!!!
16-04-2008 - 18:57
when it says " it is actually " "
17-04-2008 - 07:20
Identifying with Nickserv is pretty simple, just use PRIVMSG nickserv :identify password
Kicking someone first requires some sort of admin system you can check the other topics for that. To kick some one you can use KICK user i thought.
Hope it helps
Kicking someone first requires some sort of admin system you can check the other topics for that. To kick some one you can use KICK user i thought.
Hope it helps
17-04-2008 - 13:46
Hi there.
The identify thing is very simple just put
fputs($socket,"IDENTIFY yourpasswordn"
; after you will change his nick.
And for kicking use KICK, but be sure to read the right part of array as username
The identify thing is very simple just put
fputs($socket,"IDENTIFY yourpasswordn"
; after you will change his nick.And for kicking use KICK, but be sure to read the right part of array as username

18-04-2008 - 07:29
21-04-2008 - 21:08
The kick can depend on the server. Some servers require you to state the channel from which you want the user kicked.
If you take a look at the IRC RFC you'll get a good amount of information.
If you take a look at the IRC RFC you'll get a good amount of information.
Page:
1
Reply to topic
Reply to topic

