Git Product home page Git Product logo

bugbot's Introduction

This bot is originally created to run Mafia games on freenode. I seperated each
section into modules because some other people wanted a lightweight bot they
could do whatever they wanted to do with. I've spent more time on the framework
building it up for these people instead of the mafia part of the bot itself.

---

Run genconfig.py to set your configuration options.
Run BugBot.py to load up your bot.

---

Use genplugin.py to get a blank plugin file. I don't have command name
conflict resolving yet, so try not to use a command already in use.

The cmds class should contain all your commands as defines

There is regular expression support for snarfing strings directly out of the
chat, these are contained in the regexp class. The format of this is simple:

    def commandName(self,match):
        r'Regular Expression'
        doStuff()

match will contain the result from an re.group(0) function. Usually the matching
string.

The only infrastructure I provide for you to use is outlined below. You will
need to import any modules for anything else you need.

self._parent.
  term -> Prints to the console
  -> term(LEVEL,'TEXT')
    -> Use FUNC, SUB, DBG and ERROR for the LEVEL, 'TEXT' should be obvious.

  send - Sends a message to IRC
  -> send('TEXT',nick=False,channel=False)
    -> 'TEXT' is what you want to send
    -> nick will be prepended to TEXT if given. You can use True to provide the
       callers nick
    -> Channel will default to the current channel unless you specify otherwise

  quote - Sends a raw irc command
  -> quote('TEXT')
    -> 'TEXT' is your command

  notice - sends an irc notice
  -> notice('TEXT','TARGET')
    -> 'TEXT' is the notice content
    -> 'TARGET' can be a person or a channel

  getNick
  getHost
  getUser
  getFullHost
  getChannel
  -> All return what you'd expect

  getMessage
  -> Returns everything after the command

  getArg(argNum)
  ->getArg(num)
    -> num is any integer, it'll return the word at the position after the
        message, starting at one

        command arg1 arg2 arg3
            0    1    2    3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.