Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@sopel.module.commands('hostm')
def hostm(bot,trigger):
bot.say(trigger.host)
@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))
@sopel.module.commands('smug')
def smug(bot,trigger):
bot.say("https://i.imgur.com/%s" % random.choice(smuglist))
@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))
@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())
@module.commands('agents')
def agents(bot, trigger):
bot.say(' '.join(os.listdir(agent_path)))
@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))
@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.")
@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]))