Jump to content

IRC BOT v1.0


McGod
 Share

Recommended Posts

This is an highly modular IRC bot, it uses a plugin system so that you can easily add/remove features from the bot.

Features:

-Modular Plugin system

-Uses SQLite

-Comes with an auth system

-Automatically joins channels on connection

Plugin System

The plugin system uses a trigger system utlizing Call to allow a modular system.

For Example:

A message comes in from a channel.

The bot will loop through an array ($Plugin) which will have all the plugin's info (Name, ver, Desc, Prefix) it will take the prefix's and call Prefix_OnMsg with the info like user, channel, msg etc..

A template plugin:

_TempPlugin()


Func _TempPlugin()
    If IsDeclared("Plugin") = 0 Then Exit
    Local $i = UBound($Plugin)
    ReDim $Plugin[$i][4]
    $Plugin[$i - 1][0] = "Temp";Name of your plugin
    $Plugin[$i - 1][1] = "v1.0";Current version
    $Plugin[$i - 1][2] = "A plugin template";Description of plugin
    $Plugin[$i - 1][3] = "Temp";Plugin prefix (Temp_onload) etc..
EndFunc   ;==>_TempPlugin

;===================================================
;Function Name: Temp_onload ()
;Use: Fires on bot startup.
;Variables: None
;===================================================
Func Temp_onload();
EndFunc   ;==>Temp_onload

;===================================================
;Function Name: Temp_OnMsg ($user, $chan, $msg)
;Use: Fires on a channel or private message
;Variables: $user - Username of the person who said the message
;            $chan - Channel or username of where the message was said
;            $msg - Message that was said
;===================================================
Func Temp_OnMsg($user, $chan, $msg);
EndFunc   ;==>Temp_OnMsg

;===================================================
;Function Name: Temp_OnJoin($user, $chan)
;Use: Fires when you or someone joins a channel
;Variables: $user - User who has joined such channel
;            $chan - The channel which the bot/user has joined
;===================================================
Func Temp_OnJoin($user, $chan);
EndFunc   ;==>Temp_OnJoin

;===================================================
;Function Name: Temp_OnPart($user, $chan)
;Use: Fires when someone leaves the channel
;Variables: $user - User who has left the channel
;            $chan - The channel which the user has left
;===================================================
Func Temp_OnPart($user, $chan);
EndFunc   ;==>Temp_OnPart

;===================================================
;Function Name: Temp_OnQuit($user, $reason)
;Use: Firess when someone has quit from the server.
;Variables: $user - User who has left the server
;            $reason - Reason why user has left
;===================================================
Func Temp_OnQuit($user, $reason);
EndFunc   ;==>Temp_OnQuit

;===================================================
;Function Name: Temp_OnMode($chan, $user, $mode)
;Use: Fires when a user/channel mode has occured.
;Variables: $chan - Channel/User where the mode has occured
;            $user - User that executed the mode
;            $mode - The mode the user has executed
;===================================================
Func Temp_OnMode($chan, $user, $mode);
EndFunc   ;==>Temp_OnMode

;===================================================
;Function Name: Temp_OnKick($chan, $kicker, $user, $reason)
;Use: Fires when someone gets kicked from a channel.
;Variables: $chan - Channel were the user was kicked
;            $kicker - User who kicked the person
;            $user - User who was kicked
;            $reason - Why the user was kicked
;===================================================
Func Temp_OnKick($chan, $kicker, $user, $reason)
EndFunc   ;==>Temp_OnKick

;===================================================
;Function Name: Temp_OnNick($user, $newnick)
;Use: Fires when a user has changed their nick
;Variables: $user - User who had changed their nick
;            $newnick - Users new nick name
;===================================================
Func Temp_OnNick($user, $newnick);
EndFunc   ;==>Temp_OnNick

;===================================================
;Function Name: Temp_OnTopic($user, $chan, $topic)
;Use: Fires when the topic in a channel is changed.
;Variables: $user - User who changed the topic
;            $chan - The channel were the topic was changed
;            $topic - The new topic in the channel
;===================================================
Func Temp_OnTopic($user, $chan, $topic);
EndFunc   ;==>Temp_OnTopic

;===================================================
;Function Name: Temp_OnInvite($inviter, $user, $chan)
;Use: Fires when the bot/user is invited into a channel
;Variables: $inviter - User who invited the user into the channel
;            $user - The user who was invited
;            $chan - The channel the user was invited to
;===================================================
Func Temp_OnInvite($inviter, $user, $chan);
EndFunc   ;==>Temp_OnInvite

;===================================================
;Function Name: Temp_OnConnect($host, $port)
;Use: Fires on connection to server
;Variables: $host - The host name where the bot connected.
;            $port - The port of the where the bot connected.
;===================================================
Func Temp_OnConnect($host, $port);
EndFunc   ;==>Temp_OnConnect

;===================================================
;Function Name: Temp_OnPing($ping)
;Use: Fires on Ping recieved
;Variables: $ping - The message that you need to send back.
;===================================================
Func Temp_OnPing($ping);
EndFunc   ;==>Temp_OnPing

;===================================================
;MISC INTERNAL FUNCTIONS
;===================================================

;===================================================
;Function Name: ChanSend($chan, $msg)
;Use: To send a message to a channel
;Variables: $chan - The channel/user you want to send a message to
;            $msg - The message you want to send
;~~MISC NOTES~~
; - Bold variable
; - Underline variable
; - Color variable use it with a number from 1-15 to change color of text.
;0 white        8 yellow
;    1 black        9 lightgreen
;    2 blue        10 cyan
;    3 green        11 lightcyan
;    4 lightred    12 lightblue
;    5 brown        13 pink
;    6 purple    14 grey
;    7 orange    15 lightgrey
;===================================================

;===================================================
;Function Name: JoinChannel($chan)
;Use: To join a channel
;Variables: $chan - The Channel you want to join
;===================================================

;===================================================
;Function Name: _Query($sSQL)
;Use: To return the first return of a sqlite query.
;Variables: $sSQL - The query you wish to use
;===================================================

;===================================================
;Function Name: _SQLExec($sSQL)
;Use: Executes a SQLite database command.
;Variables: $sSQL - The command you wish to send.
;===================================================

;===================================================
;Function Name: _Log($msg)
;Use: To add to the log file
;Variables: $msg - The message you want to add to the log.
;===================================================

Download

Download v1.0

Plugins

Register.au3 - v1.0 - Allows you to give access, login etc. - Auth_

Download - Comes with v1.0

Edited by Chip
Link to comment
Share on other sites

  • 2 weeks later...

@Jaenster I would love to try out your bot I am trying to learn about TCPSend and this looks like a great example. Unfortunately your script as been stricken by a bug in these forums and I'm too much of a noob to fix it myself. Would it be possible for you to give me a download link to dump it to one of those code clipboard sites (which i cant remember the name of any of them).

Thanks! I look forward to your response.

AutoIt changed my life.

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 months later...

Here is the file, I've downloaded it a while ago :

http://dilatt.free.fr/au3/IRC%20Bot.zip

I think it won't work with the lattest au3 version : this one requires sqlite3.dll for example.

I don't have the time to rewrite it, if someone is interested....

Have fun and let us know about any improvement :P

[EDIT]

OK, the sqlite3.dll is easy to remove, just put comments before the dll load lines.

Some global vars has been defined inside a func, move them on top and that's OK.

The PluginOpen() func has been removed :) so the md5 funcs are not working.

If someone know another MD5HASH func, let us know !

[/EDIT]

Apzo.

Edited by Apzo
Link to comment
Share on other sites

Here is the file, I've downloaded it a while ago :

http://dilatt.free.fr/au3/IRC%20Bot.zip

I think it won't work with the lattest au3 version : this one requires sqlite3.dll for example.

I don't have the time to rewrite it, if someone is interested....

Have fun and let us know about any improvement :P

[EDIT]

OK, the sqlite3.dll is easy to remove, just put comments before the dll load lines.

Some global vars has been defined inside a func, move them on top and that's OK.

The PluginOpen() func has been removed :) so the md5 funcs are not working.

If someone know another MD5HASH func, let us know !

[/EDIT]

Apzo.

That link is dead too :blink:
Link to comment
Share on other sites

  • 1 month later...

Well.. I wanted to test this one..

But mine isn't working (not on Vista or XP).. I think it has something to do with the SQL, because in the log file i'm getting this.

2008-02-13 16:11:24 : SQLite Exec->Ret Value: 0->Error Msg: not an error->Query : DELETE FROM IRC_ChanSession

2008-02-13 16:11:24 : SQLite Exec->Ret Value: 0->Error Msg: not an error->Query : DELETE FROM IRC_UserSession

2008-02-13 16:11:24 : SQLite Exec->Ret Value: 0->Error Msg: not an error->Query : UPDATE IRC_Users SET login = '0'

And ff I remove all the functions which has something of a query in it... than it works.

Do you know what the problem is? I'm trying to create an IRC bot myself (off course via AutoIT)

[center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...