Add factor

This commit is contained in:
minerobber 2018-12-28 10:14:35 +00:00
parent 3759e19145
commit 496ec37bca
1 changed files with 4 additions and 2 deletions

View File

@ -1,10 +1,10 @@
import requests,plugin
import requests,plugin,subprocess
from math import floor
@plugin.command("mbtilde","<operation> [args]")
def on_mbtilde(bot,channel,nick,subcmd,*args):
for arg in args:
if (arg.isdigit() and int(arg)>100):
if (arg.isdigit() and int(arg)>100 and subcmd!="factor"):
bot.say(channel,"no u")
return
if subcmd=="ask":
@ -38,3 +38,5 @@ def on_mbtilde(bot,channel,nick,subcmd,*args):
bot.say(channel,r["best"][0])
else:
bot.say(channel,r["best"][0])
elif subcmd=="factor" and len(args)==1:
bot.say(channel,subprocess.check_output(["/usr/bin/factor",str(args[0])]).decode("ascii").split(": ")[1].replace(" ",",").strip())