How to use the sopel.module.commands function in sopel

To help you get started, we’ve selected a few sopel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dasu / syrup-sopel-modules / testmods.py View on Github external
@sopel.module.commands('hostm')
def hostm(bot,trigger):
    bot.say(trigger.host)
github anqxyr / jarvis / jarvis / modules / notes.py View on Github external
@sopel.module.commands('quote', 'q')
def quote(bot, tr):
    channel = channel_quotes_enabled(bot, tr)
    if channel:
        bot.send(jarvis.notes.dispatch_quote(tr.group(2), channel))
github dasu / syrup-sopel-modules / smug.py View on Github external
@sopel.module.commands('smug')
def smug(bot,trigger):
        bot.say("https://i.imgur.com/%s" % random.choice(smuglist))
github anqxyr / jarvis / pyscp_bot / modules / google.py View on Github external
@sopel.module.commands('google', 'g')
def google(bot, tr):
    query = tr.group(2)
    results = bot.memory['google'].list(
        q=query, cx=bot.config.google.cseid, num=1).execute()
    if not results.get('items', None):
        bot.send('Nothing found.')
        return
    title = results['items'][0]['title']
    url = results['items'][0]['formattedUrl']
    snippet = results['items'][0]['snippet']
    bot.send('\x02{}\x02 ({}) - {}'.format(title, url, snippet))
github anqxyr / jarvis / jarvis / modules / autoban.py View on Github external
@sopel.module.commands('updatebans')
def update_bans(bot, tr):
    if tr.sender != '#site67':
        return
    try:
        bot.memory['bans'] = get_ban_list()
        bot.send(jarvis.lexicon.banlist_updated())
    except:
        bot.send(jarvis.lexicon.banlist_update_failed())
github vladfi1 / phillip / twitchbot.py View on Github external
@module.commands('agents')
def agents(bot, trigger):
    bot.say(' '.join(os.listdir(agent_path)))
github russellb / sopelmods / pyjoke.py View on Github external
@module.commands('pyjoke')
def pyjoke(bot, trigger):
    j1 = pyjokes.get_jokes(category='neutral')
    j2 = pyjokes.get_jokes(category='adult')
    bot.say(random.choice(j1 + j2))
github dasu / syrup-sopel-modules / mal.py View on Github external
@sopel.module.commands('manga')
def manga(bot,trigger):
    if not trigger.group(2):
        return bot.say("Enter a mango name you weeaboo.")
    i = trigger.group(2)
    if len(i)>1 and len(trigger.group())>7:
        uri = 'http://myanimelist.net/api/manga/search.xml?q={0}'.format(i)
        bs, x = connect(uri)
        if len(x) > 14:
            bot.reply('{0} ({2}): http://myanimelist.net/manga/{1}'.format(bs.find('title').string, bs.find('id').string, bs.find('chapters').string))
        else:
            bot.say("No results.")
    else:
        bot.say("No results.")
github sopel-irc / sopel-extras / document.py View on Github external
@commands('document')
def document(bot, trigger):
    conf = bot.config.document
    layout = conf.layout or 'default'
    base_dir = conf.base_dir
    output_dir = conf.output_dir or os.path.join(base_dir, '_site')

    with open(os.path.join(base_dir, 'modules.md'), 'w') as f:
        front_matter = '''---\nlayout: {}\ntitle: {} commands list\n---\n\n'''
        f.write(front_matter.format(layout, bot.nick))
        f.write('| Command | Purpose | Example |\n')
        f.write('| ------- | ------- | ------- |\n')

        for command in sorted(bot.doc.iterkeys()):
            doc = bot.doc[command]
            docstring = doc[0].replace('\n\n', '<br>').replace('\n', ' ')
            f.write('| {} | {} | {} |\n'.format(command, docstring, doc[1]))