Inferno/Module Skeleton

From Botdom Wiki

Jump to: navigation, search
'This is where we tell VB How to run us and how to make us into something
'that inferno can use. Please dont modify this unless you know what you
'are doing.
Option Compare Text
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.Strings
Imports Inferno
Imports Microsoft
Imports System
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.IO
Imports System.Net
Imports System.Web
Imports System.Collections.Generic
Imports System.Collections
 
 
Public Class MyModule ' Change this to whatever you like. (As long as its valid)
    Implements ModuleClient 'This line is to tell Inferno that we are
    'A valid plugin. and we can be loaded.
    Dim WithEvents _MyHost As ModuleHost 'This is where we keep a copy
    'of inferno for us to use to communicate to the user, get settings
    ' And many other things.
 
 
    'This is the method that gets called when inferno loads or reloads
    'Your module. In here you need to copy Host so that you can use it
    'later. The first line of this method should always be
    'MyHost = Host
    Public Sub Init(ByVal Host As ModuleHost) Implements ModuleClient.Init
        MyHost = Host
        'In here you also want to register commands and do any
        'setup that you may need for your module. To register a command
        'Use the MyHost.RegisterCommand function.
        MyHost.RegisterCommand("yourcommand", PrivLevels.Guest, "Your commands help text.")
        'Valid Values for Privlevels are:
        ' Privlevels.Guest
        ' PrivLevels.Member
        ' PrivLevels.Senior
        ' PrivLevels.Operator 
        ' Privlevels.Administrator
        ' Privlevels.Owner
        'The privlevel only takes effect if the privlevel for the
        'command has not been set.
    End Sub
 
    'This property is here so that Inferno can set/unset _MyHost
    'You may use this property as well.
    Public Property MyHost() As ModuleHost Implements ModuleClient.MyHost
        Get
            Return _MyHost
        End Get
        Set(ByVal value As ModuleHost)
            _MyHost = value
        End Set
    End Property
    'This event will fire when ANY Command is called. So you will need to
    'respond to only YOUR Commands.
    'Room = Chatroom the command was executed in.
    'From = Who executed it.
    'Command = Command executed
    'Params = Parameters that were put after the command.
    'e is ignored by inferno and is still present for legacy reasons.
    'You can safely ignore it.
    Private Sub _MyHost_Command(ByVal Room As String, ByVal from As String, ByVal Command As String, ByVal Params As String, ByVal e As ModuleEventArgs) Handles _MyHost.Command
        Select Case Command
            Case "yourcommand"
                'Any code you put here will be run when your command is called.
                'Here is a simple example.
                MyHost.Send(Room, "$USER: Your command is working!", from)
                'To add more commands simply add another case statement
                'In-between Select and End Select
 
                'Example:
                'Case "yourcommand2"
                'More code here.
        End Select
    End Sub
 
    'This event fires whenever someone says something. Be it /me or a normal message.
    'Sender is the user that sent it, room is the room it was sent it,
    'Message is the actual message.
    Private Sub _MyHost_UserMessage(ByVal room As String, ByVal sender As String, ByVal message As String) Handles _MyHost.UserMessage
 
    End Sub
End Class
Personal tools