IRC BOT v1.0

Recommended Posts

McGod 0

McGod 0

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()IfIsDeclared("Plugin")=0ThenExitLocal$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.;===================================================

Share this post

Link to post

Share on other sites

Skizmata 0

Skizmata 0

@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).