Example #1
0
def onInit(plugin_in):
    define_command = command.Command(plugin_in, 'define', shortdesc='Define X')
    randefine_command = command.Command(plugin_in,
                                        'randefine',
                                        shortdesc='Define a random thing')
    return plugin.Plugin(plugin_in, 'urbandictionary',
                         [define_command, randefine_command])
Example #2
0
def onInit(plugin_in):
    starwiki_command = command.Command(plugin_in,
                                       'starwiki',
                                       shortdesc='Search the Star VS. Wikia')
    wikia_command = command.Command(plugin_in,
                                    'wikia',
                                    shortdesc='Search Wikia!')
    return plugin.Plugin(plugin_in, 'starwiki',
                         [starwiki_command, wikia_command])
Example #3
0
def onInit(plugin_in):
    # Set Commands
    setoffset_command = command.Command(plugin_in,
                                        'setoffset',
                                        shortdesc='Set your UTC offset.')
    time_command = command.Command(plugin_in,
                                   'time',
                                   shortdesc='Get local time.')
    return plugin.Plugin(plugin_in, 'time', [setoffset_command, time_command])
Example #4
0
def onInit(plugin_in):
    gitsrc_command = command.Command(plugin_in,
                                     'source',
                                     shortdesc='Get the git repo for the bot!')
    docs_command = command.Command(
        plugin_in, 'docs', shortdesc='Get a link to the bot\'s documentation')
    tests_command = command.Command(plugin_in,
                                    'tests',
                                    shortdesc='Get a link to the bot\'s tests')
    return plugin.Plugin(plugin_in, 'tinyurl',
                         [gitsrc_command, docs_command, tests_command])
def onInit(plugin_in):
    serverinfo_command = command.Command(
        plugin_in, SERVERINFOCMD, shortdesc="Show info about this server")
    emoteinfo_command = command.Command(
        plugin_in, EMOTEINFOCMD, shortdesc="Show the emotes on this server")
    serverinvite_command = command.Command(
        plugin_in,
        SERVERINVITECMD,
        shortdesc="Get an invite link to this server")
    return plugin.Plugin(
        plugin_in, "infoutils",
        [serverinfo_command, emoteinfo_command, serverinvite_command])
    def test_command_overwrite(self):
        cmd_test = command.Command(unittest, 'testplugin')
        self.assertEqual(cmd_test.name, 'testplugin')
        self.assertEqual(cmd_test.plugin, unittest)
        self.assertEqual(cmd_test.shortdesc, 'no description')
        self.assertEqual(cmd_test.devcommand, False)

        cmd_test = command.Command(unittest,
                                   'testplugin',
                                   shortdesc='python testing is fun!')
        self.assertEqual(cmd_test.name, 'testplugin')
        self.assertEqual(cmd_test.plugin, unittest)
        self.assertEqual(cmd_test.shortdesc, 'python testing is fun!')
        self.assertEqual(cmd_test.devcommand, False)
Example #7
0
    def test_plugin_overwrite(self):
        cmd_test = command.Command(unittest, 'TestCommand')
        plugin_test = plugin.Plugin(unittest, 'TestPlugin', [cmd_test])
        self.assertEqual(plugin_test.plugin, unittest)
        self.assertEqual(plugin_test.name, 'TestPlugin')
        self.assertEqual(plugin_test.commands, [cmd_test])

        cmd_test2 = command.Command(unittest,
                                    'TestCommand',
                                    shortdesc='Description!')
        plugin_test = plugin.Plugin(unittest, 'TestPlugin', [cmd_test2])
        self.assertEqual(plugin_test.plugin, unittest)
        self.assertEqual(plugin_test.name, 'TestPlugin')
        self.assertEqual(plugin_test.commands, [cmd_test2])
        self.assertEqual(plugin_test.commands[0].shortdesc, 'Description!')
def onInit(plugin_in):
    '''List commands for plugin.'''
    xkcd_command = command.Command(
        plugin_in,
        'xkcd',
        shortdesc='Posts the latest XKCD, or by specific ID')
    return plugin.Plugin(plugin_in, 'comics', [xkcd_command])
Example #9
0
def onInit(plugin_in):
    google_command = command.Command(plugin_in,
                                     'google',
                                     shortdesc='Google it!')
    bing_command = command.Command(plugin_in,
                                   'bing',
                                   shortdesc='Uhh... Bing it?')
    duckduckgo_command = command.Command(plugin_in,
                                         'duckduckgo',
                                         shortdesc='Ask the duck.')
    aol_command = command.Command(plugin_in,
                                  'aol',
                                  shortdesc='Here you go, gramps')
    return plugin.Plugin(
        plugin_in, 'search',
        [google_command, bing_command, duckduckgo_command, aol_command])
 def test_command_args(self):
     cmd_test = command.Command(unittest,
                                'testplugin',
                                shortdesc='python testing is fun!',
                                devcommand=True)
     self.assertEqual(cmd_test.name, 'testplugin')
     self.assertEqual(cmd_test.plugin, unittest)
     self.assertEqual(cmd_test.shortdesc, 'python testing is fun!')
     self.assertEqual(cmd_test.devcommand, True)
Example #11
0
def onInit(plugin_in):
    '''List commands for plugin.'''
    lenny_command = command.Command(plugin_in,
                                    'lenny',
                                    shortdesc='Give some Lenny')
    shrug_command = command.Command(plugin_in,
                                    'shrug',
                                    shortdesc='Shrug it off')
    tableflip_command = command.Command(plugin_in,
                                        'tableflip',
                                        shortdesc='Flip a table')
    fart_command = command.Command(plugin_in,
                                   'fart',
                                   shortdesc='PrincessZoey :P')
    beta_command = command.Command(plugin_in,
                                   'beta',
                                   shortdesc='Something went wrong™')
    return plugin.Plugin(plugin_in, 'fun', [
        lenny_command, shrug_command, tableflip_command, fart_command,
        beta_command
    ])
Example #12
0
def onInit(plugin_in):
    '''List commands for plugin.'''
    desc_base = 'Count the number of cached items '
    desc_cachecount = desc_base + 'for a command'
    desc_caches = desc_base + 'per command'
    desc_totalcache = desc_base + 'stored'
    cachecount_command = command.Command(plugin_in,
                                         'cachecount',
                                         shortdesc=desc_cachecount,
                                         devcommand=True)
    caches_command = command.Command(plugin_in,
                                     'caches',
                                     shortdesc=desc_caches,
                                     devcommand=True)
    totalcache_command = command.Command(plugin_in,
                                         'totalcache',
                                         shortdesc=desc_totalcache,
                                         devcommand=True)
    return plugin.Plugin(
        plugin_in, 'cacheutils',
        [cachecount_command, caches_command, totalcache_command])
    def test_command_change_args(self):
        cmd_test = command.Command(unittest,
                                   'testplugin',
                                   shortdesc='python testing is fun!')
        self.assertEqual(cmd_test.name, 'testplugin')
        self.assertEqual(cmd_test.plugin, unittest)
        self.assertEqual(cmd_test.shortdesc, 'python testing is fun!')
        self.assertEqual(cmd_test.devcommand, False)

        cmd_test.shortdesc = 'We\'ve changed the description!'
        self.assertEqual(cmd_test.name, 'testplugin')
        self.assertEqual(cmd_test.plugin, unittest)
        self.assertEqual(cmd_test.shortdesc, 'We\'ve changed the description!')
        self.assertEqual(cmd_test.devcommand, False)
Example #14
0
def onInit(plugin_in):
    '''List commands for plugin.'''
    lenny_command = command.Command(plugin_in,
                                    LENNYCMD,
                                    shortdesc="Give some Lenny")
    shrug_command = command.Command(plugin_in,
                                    SHRUGCMD,
                                    shortdesc="Shrug it off")
    tableflip_command = command.Command(plugin_in,
                                        TABLEFLIPCMD,
                                        shortdesc="Flip a table")
    fart_command = command.Command(plugin_in,
                                   FARTCMD,
                                   shortdesc="PrincessZoey :P")
    beta_command = command.Command(plugin_in,
                                   BETACMD,
                                   shortdesc="Something went wrong™")
    eat_command = command.Command(plugin_in,
                                  EATCMD,
                                  shortdesc="Eat someone or something")
    return plugin.Plugin(plugin_in, "fun", [
        lenny_command, shrug_command, tableflip_command, fart_command,
        beta_command, eat_command
    ])
Example #15
0
def onInit(plugin_in):
    '''List commands for plugin.'''
    eat_command = command.Command(plugin_in,
                                  'eat',
                                  shortdesc='Eat someone or something')
    return plugin.Plugin(plugin_in, 'eat', [eat_command])
 def test_command_basic_args(self):
     cmd_test = command.Command(unittest, 'testplugin')
     self.assertEqual(cmd_test.name, 'testplugin')
     self.assertEqual(cmd_test.plugin, unittest)
     self.assertEqual(cmd_test.shortdesc, 'no description')
     self.assertEqual(cmd_test.devcommand, False)
def onInit(plugin_in):
    plugins_command = command.Command(plugin_in,
                                      'plugins',
                                      shortdesc='Print a list of plugins',
                                      devcommand=True)
    commands_command = command.Command(plugin_in,
                                       'commands',
                                       shortdesc='Print a list of commands')
    help_command = command.Command(plugin_in,
                                   'help',
                                   shortdesc='Redirects to !commands')
    info_command = command.Command(plugin_in,
                                   'info',
                                   shortdesc='Print some basic bot info')
    plugintree_command = command.Command(
        plugin_in,
        'plugintree',
        shortdesc='Print a tree of plugins and commands',
        devcommand=True)
    uptime_command = command.Command(plugin_in,
                                     'uptime',
                                     shortdesc='Print the bot\'s uptime',
                                     devcommand=True)
    hostinfo_command = command.Command(
        plugin_in,
        'hostinfo',
        shortdesc='Prints information about the bots home',
        devcommand=True)
    cpuinfo_command = command.Command(
        plugin_in,
        'cpuinfo',
        shortdesc='Prints info about the system CPUs',
        devcommand=True)
    setprefix_command = command.Command(plugin_in,
                                        'setprefix',
                                        shortdesc='Set the server prefix',
                                        devcommand=True)
    getprefix_command = command.Command(plugin_in,
                                        'getprefix',
                                        shortdesc='Get the server prefix',
                                        devcommand=True)
    speedtest_command = command.Command(plugin_in,
                                        'speedtest',
                                        shortdesc='Run a speedtest',
                                        devcommand=True)
    addowner_command = command.Command(plugin_in,
                                       'addowner',
                                       shortdesc='Add a bot owner',
                                       devcommand=True)
    owners_command = command.Command(plugin_in,
                                     'owners',
                                     shortdesc='Print the bot owners',
                                     devcommand=True)
    messages_command = command.Command(
        plugin_in,
        'messages',
        shortdesc="Show how many messages the bot has seen since start")
    servers_command = command.Command(
        plugin_in, SERVERSCMD, shortdesc="Show how many servers the bot is on")
    invite_command = command.Command(
        plugin_in, 'invite', shortdesc="Invite the bot to your server!")
    nickname_command = command.Command(plugin_in,
                                       NICKNAMECMD,
                                       shortdesc="Change the bot's nickname")
    ping_command = command.Command(plugin_in, 'ping', shortdesc='Pong!')
    return plugin.Plugin(plugin_in, 'botutils', [
        plugins_command, commands_command, help_command, info_command,
        plugintree_command, uptime_command, hostinfo_command, cpuinfo_command,
        setprefix_command, getprefix_command, speedtest_command,
        addowner_command, owners_command, messages_command, servers_command,
        invite_command, nickname_command, ping_command
    ])
Example #18
0
 def test_plugin_basic_args(self):
     cmd_test = command.Command(unittest, 'TestCommand')
     plugin_test = plugin.Plugin(unittest, 'TestPlugin', [cmd_test])
     self.assertEqual(plugin_test.plugin, unittest)
     self.assertEqual(plugin_test.name, 'TestPlugin')
     self.assertEqual(plugin_test.commands, [cmd_test])
Example #19
0
def onInit(plugin_in):
    '''List commands for plugin.'''
    excuse_command = command.Command(plugin_in,
                                     'excuse',
                                     shortdesc='Dish out excuses ;)')
    return plugin.Plugin(plugin_in, 'excuses', [excuse_command])
Example #20
0
def onInit(plugin_in):
    #create the basics of our plugin
    calc_command = command.Command(plugin_in, 'calc', shortdesc='Calculate given input')
    return plugin.Plugin(plugin_in, 'calc', [calc_command])
Example #21
0
 def __init__(self):
     self.direct = command.Command(cmd='')
Example #22
0
 def __init__(self):
     self.__commands         = {}
     self.__commands_root    = t.TreeNode()
     #
     self.__cmd              = c.Command(identity=-1)
     self.__commands_root._root_cmd = self.__cmd
Example #23
0
def onInit(plugin_in):
    tinyurl_command = command.Command(plugin_in, 'tinyurl', shortdesc='Convert a link to a TinyURL')
    return plugin.Plugin(plugin_in, 'tinyurl', [tinyurl_command])
Example #24
0
def onInit(plugin_in):
    star_command = command.Command(plugin_in, STARCMD, shortdesc="Star")
    return plugin.Plugin(plugin_in, "reddit", [star_command])
Example #25
0
def onInit(plugin_in):
    goldfish_command = command.Command(
        plugin_in,
        'goldfish',
        shortdesc='Post a random picture of a goldfish to the channel')
    return plugin.Plugin(plugin_in, 'randimg', [goldfish_command])
Example #26
0
def onInit(plugin_in):
    wikipedia_command = command.Command(
        plugin_in,
        'wikipedia',
        shortdesc='Search Wikipedia, The Free Encyclopedia')
    return plugin.Plugin(plugin_in, 'wikipedia', [wikipedia_command])
Example #27
0
def onInit(plugin_in):
    setwelcome_command = command.Command(
        plugin_in,
        SETWELCOMECMD,
        shortdesc="Set the welcome message for the server.")
    return plugin.Plugin(plugin_in, "greetings", [setwelcome_command])