diff --git a/discord_script_standalone.py b/discord_script_standalone.py index 6469280..c47d723 100644 --- a/discord_script_standalone.py +++ b/discord_script_standalone.py @@ -91,7 +91,7 @@ class Discord_Module(discord.Client): async def exec_command(self, realMessage: discord.Message, command: str, rest: str): # 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 resp = requests.get(url) if resp.status_code == 200: diff --git a/standalone_command.py b/standalone_command.py index 8553195..4fc619a 100644 --- a/standalone_command.py +++ b/standalone_command.py @@ -32,7 +32,7 @@ def is_command(command: str) -> bool: else: return False -def handle_command(source, username, command, rest): +def handle_command(source, username, command, rest, bonusData): if command == "!echo": message = "Got payload [%s]" % rest #print(message) @@ -70,7 +70,7 @@ def exec_command(): else: 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__': diff --git a/twitch_script_standalone.py b/twitch_script_standalone.py index 187c0a4..867074a 100644 --- a/twitch_script_standalone.py +++ b/twitch_script_standalone.py @@ -73,9 +73,9 @@ class Twitch_Module(): resp = requests.get(url) 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 - 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 resp = requests.get(url) if resp.status_code == 200: @@ -99,7 +99,7 @@ class Twitch_Module(): is_actionable = self.is_command(command) if is_actionable: 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): # print(channel)