-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
22 lines (18 loc) · 669 Bytes
/
Copy pathmain.py
File metadata and controls
22 lines (18 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import importlib
import os
available_commands = ['Help', 'Query', 'Wiki']
def lambda_handler(event, context):
bot_event = event
commands = bot_event['text'].split(" ")
command = commands[0].title()
commands.pop(0)
argument = ' '.join(commands)
if command in available_commands:
command_class = getattr(importlib.import_module("src.commands"), command)
commandInstance = command_class()
response = commandInstance.execute(argument)
else:
response = "Command %s does not exist" % command
return {
'text': response + "environment value for key database_user " + os.environ['database_user']
}