VBBot

From Botdom Wiki
Jump to navigation Jump to search
VBBot
VBBot screenshot.gif
VBBot after a minute of use in #Botdom.
Developer(s): Plaguethenet
Programming language: Visual Basic.NET
Minimum requirements: Windows 98+, .NET Framework 2.0
Development state: Discontinued
Source model: Open source
Last stable release: 1.0RC2 (Dec 17, 2006)
Last preview release: 1.0 (TBA)



Discontinued Project
This project has been discontinued and is not recommended for use.

VBBot is a Visual Basic .NET bot by plaguethenet. Currently in early development state. Newest version is available here: http://download.botdom.com/8qxvc/Setup.exe

Note: This installer does not install all of the plugins and makes the bot seem very broken. The missing plugins are available for download here: http://download.botdom.com/e61yu/plugins.zip Simply unzip the plugins to your plugins folder. I.e.: C:\Program Files\StrangeSoft\VBBot\Plugins

Features

  • Standard bot commands all implemented as plugins.
  • A plugin system that accepts .NET Class libraries compiled against VBBot or Script files written in VB.NET
  • VBBot does not traverse its plugin directory to lookup plugins, Instead it loads them once and looks them up from a hashtable. A Hashtable is an array where each element is refered to by a key. In this instance the keys are strings. This leads to much better performance and less Disk IO. But if you add a plugin you must reload all plugins in order to use it.
  • Script Based Plugins are Compiled when loaded, And kept in memory. DLL's are loaded and referenced.
  • Scripts are provided references to the following libraries: System.dll, System.Web.dll, System.Windows.Forms.dll, and VBBot.exe . You must import what you need as there is no way for VBBot to give your script default Imports. There is a list of suggested default imports at the bottom of this page.
  • XML Settings
  • Plugin Caching

Planned Features

  • Include a plugin compiler for those of you who don't have VB.NET So that you can make DLL's as well.
  • Implement a 2nd plugin interface that provides access to "raw" tablumps from dAmn.
  • Allow plugins to send and receive Admin and whois queries.

Help

Change Log

1.0

  • Heavily modified the settings class to allow new ways of working with it.
  • Changed setting format from Windows INI files to XML files.
  • Added initial support for SendRaw, ReceiveRaw But these functions are not available to plugins just yet.
  • Fixed a bug with corrupt settings, Each time the settings are saved the old settings are backed up to settings.xml.old, If settings.xml becomes corrupt the bot will load settings.xml.old, delete settings.xml and rename settings.xml.old to settings.xml. VBbot saves VERY often. So the loss of data should be very minimal.
  • Settings now supports Direct Assignment, In this example s will refer to a settings object and d will refer to a double: <vbnet-inline>s("path")("to")("variable") = d</vbnet-inline>. Before this you had to do <vbnet-inline>s("path")("to")("variable").Value = CStr(d)</vbnet-inline>. Valid implicit narrowing conversions are as follows: <vbnet-inline>String</vbnet-inline>, <vbnet-inline>Integer</vbnet-inline>, <vbnet-inline>Single</vbnet-inline>, <vbnet-inline>Double</vbnet-inline>, <vbnet-inline>Long</vbnet-inline>, and <vbnet-inline>boolean</vbnet-inline>. It should also be noted that this assignment works both ways.
  • Turned off the LogToPChat feature.
  • Added the ability to enable/disable the Log To PChat feature, But no command has been implemented yet to change it. You may change it by editing config\settings.xml and changing bot\logtopchat from <vbnet-inline>FALSE</vbnet-inline> to <vbnet-inline>TRUE</vbnet-inline>. (Note that these two words must be in uppercase.)
  • Errors in the bot no longer disconnect it from dAmn (hopefully) due to improved Error trapping.
  • Added initial XML Metadata support. Its not used for anything as of yet, But the metadata is written to the file.
  • Changed the location of log files, since log files were getting too big. Logs are now located in log\YYYY-MM-DD\ and rotated daily.
  • Modified the plugin handler to cache plugins, This is only the initial cache support and will be modified in the future. Im going to change it so that the version of the bot will change the checksum of the file. This will prevent the bot from loading stale plugins after an upgrade. But this functionality has yet to be implemented.
  • The plugin cache system Greatly reduces plugin load time. This difference should be well noticeable.
  • Added support for a response when the user issues a bad command. This can be modified using the badcommand command. Variables for this string are as follows: $USER$ (username) $ROOM$ (name of the chatroom without a #) and $COMMAND$ (name of the command that the user attempted to run.)
  • Finalized Stage 1 Regression Testing. The bot is no longer beta. Bug reports are still welcome.

0.6f

  • Fixed some of the builtin plugins.
  • exec now works correctly.
  • Re-worked the VBBot GUI
  • Added a bot launcher (choose between GUI and Console modes)
  • Added a settings browser/editor
  • Added HTML View in the VBBot GUI (see the room somewhat like you would on dAmn)
  • Added support for GZipped plugins. (script plugins only, DLL's cannot be loaded compressed, To use gzip the plugin you want to use and rename it *.cpi)
  • Added an MSI Based installer.

0.4f

  • Feature Implementation Complete
  • Added the initial PluginV2 Interface (Do not use as it WILL be changed)
  • Fixed several small issues and updated some of the plugins
  • Created a new settings system (All old settings will NOT be loaded. Due to MAJOR changes)
  • Minor bug fixes
  • Fixed a null reference exception when starting and loading the security section of the config.
  • DLL's now execute Faster then scripts.
  • Moved ALL bot Code to a DLL and Added a console version of the bot.
  • Created an A.L.I.C.E. Bot for VBBot.
  • Added a properties object for room data.
  • Created a small and simple trivia game.
  • Implemented a help command.

0.3b

  • More Bug Fixes
  • code cleanups, And optimizations.

0.3a

  • Minor bug fixes
  • Code restructuring
  • Added system.web.dll to the internal compiler references. So all plugins now have access to the system.web namespace
  • Ported Define.php to VBBot.

0.3

  • Initial Release.

VBBot/Change_Log

Plugin Interface

<vbnet>

   Function Init(ByVal host As HostInterface) As Boolean
   Sub Command(ByVal room As String, ByVal name As String, ByVal commandparam As String, ByVal command As String)
   Sub GotText(ByVal name As String, ByVal Room As String, ByVal message As String)
   Sub Joined(ByVal userinfo As Global.Bot.UserInf, ByVal room As String, ByVal show As Boolean)
   Sub Left(ByVal name As String, ByVal room As String, ByVal show As Boolean)
   Sub LoggedIn()
   Function About() As String

</vbnet>

Host Interface

<vbnet>

   Function RegisterCommand(ByVal command As String, ByVal plugin As VBBotPluginInterface, Optional ByVal dplvl As Integer = 25) As Boolean
   Function RegisterCommandV2(ByVal command As String, ByVal plugin As VBBotPluginV2, ByVal base As VBBotPluginInterface, Optional ByVal DPlevel As Integer = 25) As Boolean
   Function Join(ByVal room As String) As Boolean
   Sub Part(ByVal room As String)
   Sub SendGeneral(ByVal room As String, ByVal Message As String, Optional ByVal NP As Boolean = True)
   Sub SendDirected(ByVal name As String, ByVal room As String, ByVal message As String, Optional ByVal NP As Boolean = True)
   Sub SendEmote(ByVal room As String, ByVal message As String)
   Sub Kick(ByVal who As String, ByVal room As String, Optional ByVal Reason As String = "")
   Sub promote(ByVal who As String, ByVal room As String)
   Sub demote(ByVal who As String, ByVal room As String)
   Function MyName() As String
   Function MyTrigger() As String
   Sub DisplayConsoleMessage(ByVal Category As String, ByVal message As String)
   Sub Broadcast(ByVal message As String)
   Sub SaveSettingS(ByVal name As String, ByVal Key As String, ByVal Data As String)
   Sub SaveSettingI(ByVal name As String, ByVal key As String, ByVal data As Integer)
   Function LoadSettingI(ByVal name As String, ByVal key As String, ByVal DVar As Integer) As Integer
   Function LoadSettingS(ByVal name As String, ByVal Key As String, Optional ByVal DefaultS As String = "") As String
   Function MyOwner() As String
   Function RegisterForChat(ByVal plugin As VBBotPluginInterface) As Boolean
   Function RegisterForChatV2(ByVal plugin As VBBotPluginV2, ByVal base As VBBotPluginInterface) As Boolean
   Sub JoinPChat(ByVal whowith As String)
   Sub RegisterLogger(ByVal lplugin As Logger)
   Function GetRootSettingObject() As Setting
   Function GetPropertiesObject() As Setting
   Sub ReloadSettings()
   Sub RegsiterCommandHelp(ByVal command As String, ByVal helpstring As String)
   Sub WriteLog(ByVal section As String, ByVal message As String)
   Function CommandList() As String()
   Function GetCommandPerm(ByVal command As String) As Integer
   Function GetUserPerm(ByVal username As String) As Integer
   Sub SetUserPerm(ByVal username As String, Optional ByVal privlevel As Integer = 25)
   Sub DeleteUser(ByVal username As String)
   Sub ReloadPlugins()
   Sub Reconfig()
   Sub SetCommandAccess(ByVal command As String, ByVal privlevel As String)
   Function PluginCount() As Integer
   Function CommandCount() As Integer
   Function GLCount() As Integer
   Function AuthToken() As String
   Function UserList() As String()
   Function IsDisabled(ByVal command As String) As Boolean
   Sub Disable(ByVal command As String)
   Sub Enable(ByVal command As String)
   Function GetDisabled() As String()
   Sub ExecuteCommand(ByVal command As String, ByVal from As String, ByVal param As String, ByVal room As String)
   Sub Quit()

</vbnet>

UserInf Data Type

<vbnet>

   Dim GPC As String
   Dim PC As String
   Dim name As String
   Dim typename As String
   Dim Realname As String
   Dim symbol As String

</vbnet>

Suggested Plugin Imports

<vbnet>

   Option Compare Text
   Imports Bot
   Imports Microsoft.VisualBasic.Strings
   Imports Microsoft.VisualBasic
   Imports System.Diagnostics
   Imports System.Collections
   Imports System

</vbnet>

Plugin Template

<vbnet> Imports Bot 'Allows you to write plugins. Imports Microsoft.VisualBasic.Strings 'Allows you to work with Strings in VBish way. Imports Microsoft.VisualBasic 'Allows you to use Basic VBish functions. Imports System.Diagnostics 'Allows you to use Stopwatches and basic utility functions. Imports System.Collections 'Gives you Collection Datatypes. (eg, HashTable Collection) Imports System.Net 'Allows you to connect to the internet. Imports System.IO 'File IO Imports System 'System Routines. Imports VBSettings 'Allows you to use the VBBot Settings Interface.

Public Class Skel

   Implements VBBotPluginInterface
   Dim MyHost As HostInterface 'Keeps a reference to the bot so you can interact with it and dAmn.
   Public Function About() As String Implements Bot.VBBotPluginInterface.About
       Return "About your plugin - Year - :devYourUserName:"
   End Function
   Public Sub Command(ByVal room As String, ByVal name As String, ByVal commandparam As String, ByVal command As String) Implements Bot.VBBotPluginInterface.Command
       Select Case command
           Case "mycommand" 'Command the you registered with MyHost.RegisterCommand
               'Insert code here
           Case "mycommand2"
               'insert code here
           Case Else
               'Error with VBBot Please report it to me
               MyHost.DisplayConsoleMessage("BUG", "Fired a command that did not belong to the plugin " + Me.GetName)
       End Select
   End Sub
   Public Function GetName() As String Implements Bot.VBBotPluginInterface.GetName
       Return "Your Plugins Name"
   End Function
   Public Sub GotText(ByVal name As String, ByVal Room As String, ByVal message As String) Implements Bot.VBBotPluginInterface.GotText
   End Sub
   'Not required. But helpful.
   Private Sub RegisterCommandWithHelp(ByVal command As String, ByVal help As String, Optional ByVal dplvl As Integer = 25)
       MyHost.RegisterCommand(command, Me, dplvl)
       MyHost.RegsiterCommandHelp(command, help)
   End Sub
   Public Function Init(ByVal host As Bot.HostInterface) As Boolean Implements Bot.VBBotPluginInterface.Init
       MyHost = host 'Save our host we will need it.
       RegisterCommandWithHelp("mycommand", "mycommandhelp", 25)
       'Uncomment the next line if you want to get GotLine, joined, Loggedin or left events.
       'MyHost.RegisterForChat(me)
   End Function
   Public Sub Joined(ByVal userinfo As Bot.UserInf, ByVal room As String, ByVal show As Boolean) Implements Bot.VBBotPluginInterface.Joined
   End Sub
   Public Sub Left(ByVal name As String, ByVal room As String, ByVal show As Boolean) Implements Bot.VBBotPluginInterface.Left
   End Sub
   Public Sub LoggedIn() Implements Bot.VBBotPluginInterface.LoggedIn
   End Sub

End Class </vbnet>