Esempio n. 1
0
File: cli.py Progetto: nextblu/Jelly
 def handle(self, cli_args):
     super().handle(cli_args)
     commands = command.Commands(cli_args.commands_module)
     transport.ThreadingServer.allow_reuse_address = True
     server = transport.ThreadingServer(
         cli_args.cafile, cli_args.keyfile, (cli_args.server, int(cli_args.port)), commands.apply)
     server.serve_forever()
Esempio n. 2
0
 def test_maximum(self):
     c = command.Commands("tests.mock_commands")
     self.assertEqual(
         c.apply({
             "function": "maximum",
             "params": ["23", "12", "987", "99"]
         }), "99")
Esempio n. 3
0
import sys
sys.path.append("modules/")
import helper
import command

#Author : Omer Gunal (https://github.com/omergunal, https://twitter.com/ogunal00)

# Create the kernel and learn AIML files
kernel = aiml.Kernel()
kernel.learn("aiml/std-startup.xml")

kernel.respond("load aiml b")

os.system('cls' if os.name == 'nt' else 'clear')  # clear terminal

# Press CTRL-C to break this loop
while True:
    message = raw_input(">> ")
    if message == "quit" or message == "exit":  # exit from chat
        print("bye...")
        exit()
    elif message == "save":
        kernel.saveBrain("bot_brain.brn")
    elif message[:1] == "!":  # If the message specifies a command
        split_message = message.split()  # split message
        command.Commands(split_message)  # send to command module
    else:
        bot_response = kernel.respond(message)
        # Do something with bot_response
        print(bot_response)
Esempio n. 4
0
 def test_maxsize(self):
     c = command.Commands("tests.mock_commands")
     self.assertEqual(c.apply({
         "function": "maxsize",
         "params": []
     }), 9223372036854775807)
Esempio n. 5
0
 def test_upper(self):
     c = command.Commands("tests.mock_commands")
     self.assertEqual(c.apply({
         "function": "upper",
         "params": ["ciao"]
     }), "CIAO")