Added Bonus Data Arg

This commit is contained in:
Alex Orid 2021-04-21 17:56:08 -04:00
parent 7bb733cb6d
commit 1f21ad547c
3 changed files with 6 additions and 6 deletions

View File

@ -91,7 +91,7 @@ class Discord_Module(discord.Client):
async def exec_command(self, realMessage: discord.Message, command: str, rest: str): async def exec_command(self, realMessage: discord.Message, command: str, rest: str):
# todo need to url-escape command and rest # todo need to url-escape command and rest
params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Discord, 'user_name': realMessage.author.mention, 'command_name': command, 'rest': rest}) params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Discord, 'user_name': realMessage.author.mention, 'command_name': command, 'rest': rest, 'bonus_data': realMessage})
url = "http://localhost:5000/api/v1/exec?%s" % params url = "http://localhost:5000/api/v1/exec?%s" % params
resp = requests.get(url) resp = requests.get(url)
if resp.status_code == 200: if resp.status_code == 200:

View File

@ -32,7 +32,7 @@ def is_command(command: str) -> bool:
else: else:
return False return False
def handle_command(source, username, command, rest): def handle_command(source, username, command, rest, bonusData):
if command == "!echo": if command == "!echo":
message = "Got payload [%s]" % rest message = "Got payload [%s]" % rest
#print(message) #print(message)
@ -70,7 +70,7 @@ def exec_command():
else: else:
username = request.args['user_name'] username = request.args['user_name']
return handle_command(request.args['command_source'], username, request.args['command_name'], request.args['rest']) return handle_command(request.args['command_source'], username, request.args['command_name'], request.args['rest'], request.args['bonus_data'])
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -73,9 +73,9 @@ class Twitch_Module():
resp = requests.get(url) resp = requests.get(url)
return resp.status_code == 200 return resp.status_code == 200
def exec_command(self, username, command: str, rest: str): def exec_command(self, realMessage: twitch.chat.Message, command: str, rest: str):
# todo need to url-escape command and rest # todo need to url-escape command and rest
params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Twitch,'user_name': username, 'command_name': command, 'rest': rest}) params = urlencode({'command_source': commands.command_base.AbstractCommand.CommandSource.Twitch,'user_name': realMessage.sender, 'command_name': command, 'rest': rest, 'bonus_data': realMessage})
url = "http://localhost:5000/api/v1/exec?%s" % params url = "http://localhost:5000/api/v1/exec?%s" % params
resp = requests.get(url) resp = requests.get(url)
if resp.status_code == 200: if resp.status_code == 200:
@ -99,7 +99,7 @@ class Twitch_Module():
is_actionable = self.is_command(command) is_actionable = self.is_command(command)
if is_actionable: if is_actionable:
if self.cooldownModule.isCooldownActive("twitchChat") == False: if self.cooldownModule.isCooldownActive("twitchChat") == False:
self.exec_command(message.sender ,command, rest) self.exec_command(message ,command, rest)
def isChannel_inConfigList(self, selectedChannel, selectedList): def isChannel_inConfigList(self, selectedChannel, selectedList):
# print(channel) # print(channel)