Viewing topic:Irc bot Commands
Page: 1
Topic post 16-04-2008 - 18:54
Allright read my code if you give an answer make sure i got the right code in my bot

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] == "&quot;)
if ($_POST[host] == "&quot;)
if ($_POST[room] == "&quot;)
if ($_POST[port] =="&quot;){
header("Location: ircbot.html&quot;);
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&quot;) or die('Could not connect to the server');
 
 
 
fputs($socket,"USER CMbot combined-minds.net CM :wesbn&quot;);
fputs($socket,"NICK $nickn&quot;);
 
// 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&quot;)
{
fputs($socket, "PONG ".$ex[1]."n&quot;);
}
 
// Join a channel
fputs($socket,"JOIN $roomn&quot;);
 
 
// 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&quot;);
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&quot;);
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&quot;);
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&quot;);
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&quot;);
break;
 
 
case ':!leave':
fputs($socket,"PRIVMSG ".$ex[2]." No Please dont! (O_0)n&quot;);
 
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!!!
Topic post 16-04-2008 - 18:57
when it says &quot it is actually " "
Topic post 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
Topic post 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

Topic post 18-04-2008 - 07:29
Realshwdow, you forgot the person you want so send to, you have to send it to Nickserv.
Topic post 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.

©Copyrights Combined Minds. All rights reserved 2006 - 2008 : Disclaimer
Realized by www.Minna-Media.com