Beispiel #1
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!')
Beispiel #2
0
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!')
    restart_command    = command.Command(plugin_in, 'restart', shortdesc='Restart (and update) the bot')
    listservers_command= command.Command(plugin_in, 'listservers', shortdesc='List the servers the bot is in')
    changegame_command = command.Command(plugin_in, 'changegame', shortdesc="Change the bot's game")
    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,
                                                 restart_command, listservers_command, changegame_command])
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])
Beispiel #4
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])
Beispiel #5
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])
Beispiel #6
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])
Beispiel #7
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])
Beispiel #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])
Beispiel #10
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
    ])
Beispiel #11
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])
Beispiel #12
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
    ])
Beispiel #13
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])
Beispiel #14
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])
Beispiel #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])
Beispiel #16
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])
Beispiel #17
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])
Beispiel #18
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])
Beispiel #19
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])
Beispiel #20
0
def onInit(plugin_in):
    star_command = command.Command(plugin_in, STARCMD, shortdesc="Star")
    return plugin.Plugin(plugin_in, "reddit", [star_command])
Beispiel #21
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])